Skip to content
This repository was archived by the owner on Aug 11, 2021. It is now read-only.

Commit eb64949

Browse files
committed
Fix ssl.certificate miscommunication
1 parent 88399fa commit eb64949

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

lib/initialize.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function getAgent (protocol, config) {
6565
localAddress : config.proxy.localAddress,
6666
rejectUnauthorized : config.ssl.strict,
6767
ca : config.ssl.ca,
68-
cert : config.ssl.cert,
68+
cert : config.ssl.certificate,
6969
key : config.ssl.key
7070
})
7171
}

test/initialize.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,20 @@ test("initializing with proxy undefined", function (t) {
7272
t.notOk("proxy" in options, "proxy can be read from env.PROXY by request")
7373
t.end()
7474
})
75+
76+
test("initializing with a certificate should map down to the https agent", function (t) {
77+
var certificate = '-----BEGIN CERTIFICATE----- TEST\nTEST -----END CERTIFICATE-----\n'
78+
var client = new Client({
79+
ssl: {
80+
certificate: certificate
81+
}
82+
})
83+
var options = client.initialize(
84+
{ protocol: "https:" },
85+
"GET",
86+
"application/json",
87+
{}
88+
)
89+
t.equal(options.agent.options.cert, certificate, "certificate will be saved properly on agent")
90+
t.end()
91+
})

0 commit comments

Comments
 (0)