Comparing version 3.2.2 to 4.0.0
var http_1 = require('http'); | ||
var https_1 = require('https'); | ||
var agent = require('infinity-agent'); | ||
var stream_1 = require('stream'); | ||
@@ -48,5 +47,2 @@ var urlLib = require('url'); | ||
arg.key = options.key; | ||
if (!arg.agent) { | ||
arg.agent = isHttp ? agent.http.globalAgent : agent.https.globalAgent; | ||
} | ||
var req = engine(arg); | ||
@@ -53,0 +49,0 @@ var requestProxy = new stream_1.PassThrough(); |
@@ -5,2 +5,4 @@ var test = require('blue-tape'); | ||
var Promise = require('any-promise'); | ||
var fs_1 = require('fs'); | ||
var path_1 = require('path'); | ||
var popsicle = require('../common'); | ||
@@ -23,2 +25,3 @@ var SHORTHAND_METHODS = [ | ||
var REMOTE_URL = 'http://localhost:' + process.env.PORT; | ||
var REMOTE_HTTPS_URL = 'https://localhost:' + process.env.HTTPS_PORT; | ||
var EXAMPLE_BODY = { | ||
@@ -866,2 +869,35 @@ username: 'blakeembrey', | ||
} | ||
if (!popsicle.browser) { | ||
test('https reject unauthorized', function (t) { | ||
t.plan(1); | ||
return popsicle.get({ | ||
url: "" + REMOTE_HTTPS_URL | ||
}) | ||
.catch(function (err) { | ||
t.equal(err.code, 'EUNAVAILABLE'); | ||
}); | ||
}); | ||
test('https ca option', function (t) { | ||
return popsicle.get({ | ||
url: "" + REMOTE_HTTPS_URL, | ||
options: { | ||
ca: fs_1.readFileSync(path_1.join(__dirname, '../../scripts/support/ca-crt.pem')) | ||
} | ||
}) | ||
.then(function (res) { | ||
t.equal(res.body, 'Success'); | ||
}); | ||
}); | ||
test('https disable reject unauthorized', function (t) { | ||
return popsicle.get({ | ||
url: "" + REMOTE_HTTPS_URL, | ||
options: { | ||
rejectUnauthorized: false | ||
} | ||
}) | ||
.then(function (res) { | ||
t.equal(res.body, 'Success'); | ||
}); | ||
}); | ||
} | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "popsicle", | ||
"version": "3.2.2", | ||
"version": "4.0.0", | ||
"description": "Simple HTTP requests for node and the browser", | ||
@@ -23,7 +23,7 @@ "main": "dist/common.js", | ||
"build": "rm -rf dist/ && tsc && npm run check-size", | ||
"test-spec": "npm run test-server-open && PORT=7357 node dist/test/index.js | tap-spec; EXIT=$?; npm run test-server-close; exit $EXIT", | ||
"test-cov": "PORT=7357 istanbul cover --print none dist/test/index.js | tap-spec", | ||
"test-browser": "PORT=7357 browserify -d -t envify dist/test/index.js | tape-run --render tap-spec", | ||
"test-server-open": "PORT=7357 node scripts/server.js & echo $! > test.pid", | ||
"test-server-close": "if [ -f test.pid ]; then kill -9 $(cat test.pid); rm test.pid; fi", | ||
"test-spec": "npm run test-server-open && HTTPS_PORT=7358 PORT=7357 node dist/test/index.js | tap-spec; EXIT=$?; npm run test-server-close; exit $EXIT", | ||
"test-cov": "HTTPS_PORT=7358 PORT=7357 istanbul cover --print none dist/test/index.js | tap-spec", | ||
"test-browser": "HTTPS_PORT=7358 PORT=7357 browserify -d -t envify dist/test/index.js | tape-run --render tap-spec", | ||
"test-server-open": "PORT=7357 node scripts/server.js & echo $! > server.pid; HTTPS_PORT=7358 node scripts/https-server.js & echo $! > https-server.pid", | ||
"test-server-close": "if [ -f server.pid ]; then kill -9 $(cat server.pid); rm server.pid; fi; if [ -f https-server.pid ]; then kill -9 $(cat https-server.pid); rm https-server.pid; fi", | ||
"test": "npm run lint && npm run build && npm run test-server-open && npm run test-cov && npm run test-browser; EXIT=$?; npm run test-server-close; exit $EXIT", | ||
@@ -74,3 +74,2 @@ "prepublish": "typings install && npm run build" | ||
"form-data": "^0.2.0", | ||
"infinity-agent": "^2.0.3", | ||
"make-error-cause": "^1.0.1", | ||
@@ -77,0 +76,0 @@ "methods": "^1.1.1", |
@@ -13,3 +13,2 @@ { | ||
"form-data": "github:typings/typed-form-data#edc32200ec6065d98bfaa7ff9cfd104e17c5d3e4", | ||
"infinity-agent": "github:typings/typed-infinity-agent#545612609b0d4b36ba98b3f2c0f83484af1978ae", | ||
"make-error-cause": "npm:make-error-cause", | ||
@@ -16,0 +15,0 @@ "methods": "github:typings/typed-methods#b902fa13683e95d54b2bb69188f68ea3525ec430", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
168460
8
2093
4
- Removedinfinity-agent@^2.0.3
- Removedinfinity-agent@2.0.3(transitive)