Closed mefellows closed 7 years ago
Thanks for this! 👍
v2.2.0
should publish in the next half an hour or so. Should get you up and going!
@mefellows If i create my provider with sslcerts:
exports.backendSelfSignedPactConfig = {
...commonConfigPact,
ssl: true,
port: 12347,
sslcert: path.join(__dirname, '/certs/self-signed/server-crt.pem'),
sslkey: path.join(__dirname, '/certs/self-signed/server-key.pem')
};
POST data to mock service
{
method: 'POST',
url: 'https://localhost:12347/success',
data: < Buffer 7 b 22 38 29 > ,
headers: {
'accept-encoding': 'gzip, deflate',
'user-agent': 'node-superagent/2.3.0',
'content-type': 'application/json',
authorization: 'Bearer asfdsdf-asdf-sdfas-asdf-234asdf234234',
'content-length': '35',
connection: 'close'
},
validateStatus: [Function: validateStatus],
httpsAgent: Agent {
domain: null,
_events: {
free: [Function]
},
_eventsCount: 1,
_maxListeners: undefined,
defaultPort: 443,
protocol: 'https:',
options: {
ca: [Object],
path: null
},
requests: {},
sockets: {},
freeSockets: {},
keepAliveMsecs: 1000,
keepAlive: false,
maxSockets: Infinity,
maxFreeSockets: 256,
maxCachedSessions: 100,
_sessionCache: {
map: {},
list: []
}
}
}
[Object] is coming from here-> fs.readFileSync(path.join(__dirname, '/certs/self-signed/ca-crt.pem'))
Versions: @pact-foundation/pact": "^5.3.0" -> "@pact-foundation/pact-node": "^6.5.0"
Then I do client request from nodejs to that mock server and always is working it doesn't matter that the certificates are invalid (expired, wrong keys etc) never the test is broke.
What can be happening? @
So you have provided the mock service with invalid certificates and are expecting the calls to fail?
I'll check in our code, it's possible we're setting the session to allow insecure SSL as this is probably the common case here.
What are you expecting and what would you like to see changed?
I wonder if this is why https://github.com/pact-foundation/pact-node/blob/master/bin/pact-cli.spec.ts#L208
@mboudreau - feels like this should be behind a flag and something a user has control over?
See https://github.com/pact-foundation/pact-node/issues/27