Skip to content
This repository has been archived by the owner on Jul 12, 2019. It is now read-only.

Fix bug: Can't use unencrypted http:// protocol when SSL checks are disabled #135

Merged
merged 1 commit into from
Jan 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/http-middlewares/before/disable-ssl-cert-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const https = require('https');
const disableSSLCertCheck = req => {
if (req.agent) {
req.agent.options.rejectUnauthorized = false;
} else {
} else if (req.url.startsWith('https://')) {
req.agent = new https.Agent({ rejectUnauthorized: false });
}
return req;
Expand Down
9 changes: 9 additions & 0 deletions test/create-request-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,15 @@ describe('request client', () => {
});
});

it('should allow unencrypted requests when SSL checks are disabled', () => {
const newInput = _.cloneDeep(input);
newInput._zapier.event.verifySSL = false;
const request = createAppRequestClient(newInput);
return request('http://zapier-httpbin.herokuapp.com/get').then(response => {
response.status.should.eql(200);
});
});

it('should not omit empty params by default', () => {
const request = createAppRequestClient(input);
return request({
Expand Down