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

Commit

Permalink
Merge pull request #135 from zapier/fix-unencrypted-requests
Browse files Browse the repository at this point in the history
Fix bug: Can't use unencrypted http:// protocol when SSL checks are disabled
  • Loading branch information
eliangcs authored Jan 9, 2019
2 parents 42ad3a1 + 50aa706 commit 1650968
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
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

0 comments on commit 1650968

Please sign in to comment.