diff --git a/packages/server/lib/api.js b/packages/server/lib/api.js index e75f9a5df594..a65ba64b541e 100644 --- a/packages/server/lib/api.js +++ b/packages/server/lib/api.js @@ -54,6 +54,7 @@ const rp = request.defaults((params = {}, callback) => { proxy: null, gzip: true, cacheable: false, + rejectUnauthorized: true, }) const headers = params.headers != null ? params.headers : (params.headers = {}) diff --git a/packages/server/test/unit/api_spec.js b/packages/server/test/unit/api_spec.js index c7901c04cffd..7d56426f988f 100644 --- a/packages/server/test/unit/api_spec.js +++ b/packages/server/test/unit/api_spec.js @@ -69,6 +69,20 @@ describe('lib/api', () => { }) }) + it('sets rejectUnauthorized on the request', () => { + nock.cleanAll() + + return api.ping() + .thenThrow() + .catch(() => { + expect(agent.addRequest).to.be.calledOnce + + expect(agent.addRequest).to.be.calledWithMatch(sinon.match.any, { + rejectUnauthorized: true, + }) + }) + }) + context('with a proxy defined', () => { beforeEach(function () { nock.cleanAll()