teeny-request
Advanced tools
Comparing version 5.2.1 to 5.3.0
@@ -42,7 +42,6 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var http_1 = require("http"); | ||
var https_1 = require("https"); | ||
var node_fetch_1 = require("node-fetch"); | ||
var stream_1 = require("stream"); | ||
var uuid = require("uuid"); | ||
var agents_1 = require("./agents"); | ||
var streamEvents = require('stream-events'); | ||
@@ -63,3 +62,3 @@ var RequestError = /** @class */ (function (_super) { | ||
function requestToFetchOptions(reqOpts) { | ||
var options = __assign({ method: reqOpts.method || 'GET' }, (reqOpts.timeout && { timeout: reqOpts.timeout }), (reqOpts.gzip && { compress: reqOpts.gzip })); | ||
var options = __assign(__assign({ method: reqOpts.method || 'GET' }, (reqOpts.timeout && { timeout: reqOpts.timeout })), (reqOpts.gzip && { compress: reqOpts.gzip })); | ||
if (typeof reqOpts.json === 'object') { | ||
@@ -89,25 +88,3 @@ // Add Content-type: application/json header | ||
} | ||
var isHttp = uri.startsWith('http://'); | ||
var proxy = reqOpts.proxy || | ||
process.env.HTTP_PROXY || | ||
process.env.http_proxy || | ||
process.env.HTTPS_PROXY || | ||
process.env.https_proxy; | ||
if (proxy) { | ||
if (isHttp) { | ||
// tslint:disable-next-line variable-name | ||
var HttpProxyAgent = require('http-proxy-agent'); | ||
options.agent = new HttpProxyAgent(proxy); | ||
} | ||
else { | ||
// tslint:disable-next-line variable-name | ||
var HttpsProxyAgent = require('https-proxy-agent'); | ||
options.agent = new HttpsProxyAgent(proxy); | ||
} | ||
} | ||
else if (reqOpts.forever) { | ||
options.agent = isHttp | ||
? new http_1.Agent({ keepAlive: true }) | ||
: new https_1.Agent({ keepAlive: true }); | ||
} | ||
options.agent = agents_1.getAgent(uri, reqOpts); | ||
return { uri: uri, options: options }; | ||
@@ -271,3 +248,3 @@ } | ||
return function (reqOpts, callback) { | ||
var opts = __assign({}, defaults, reqOpts); | ||
var opts = __assign(__assign({}, defaults), reqOpts); | ||
if (callback === undefined) { | ||
@@ -274,0 +251,0 @@ return teenyRequest(opts); |
# Changelog | ||
## [5.3.0](https://www.github.com/googleapis/teeny-request/compare/v5.2.1...v5.3.0) (2019-10-09) | ||
### Bug Fixes | ||
* **deps:** update dependency https-proxy-agent to v3 ([#89](https://www.github.com/googleapis/teeny-request/issues/89)) ([dfd52cc](https://www.github.com/googleapis/teeny-request/commit/dfd52cc)) | ||
### Features | ||
* agent pooling ([#86](https://www.github.com/googleapis/teeny-request/issues/86)) ([b182f51](https://www.github.com/googleapis/teeny-request/commit/b182f51)) | ||
### [5.2.1](https://www.github.com/googleapis/teeny-request/compare/v5.2.0...v5.2.1) (2019-08-14) | ||
@@ -4,0 +16,0 @@ |
{ | ||
"name": "teeny-request", | ||
"version": "5.2.1", | ||
"version": "5.3.0", | ||
"description": "Like request, but smaller.", | ||
@@ -39,3 +39,3 @@ "main": "./build/src/index.js", | ||
"http-proxy-agent": "^2.1.0", | ||
"https-proxy-agent": "^2.2.1", | ||
"https-proxy-agent": "^3.0.0", | ||
"node-fetch": "^2.2.0", | ||
@@ -48,3 +48,2 @@ "stream-events": "^1.0.5", | ||
"@types/mocha": "^5.2.5", | ||
"@types/nock": "^10.0.0", | ||
"@types/node-fetch": "^2.1.2", | ||
@@ -58,3 +57,3 @@ "@types/sinon": "^7.0.13", | ||
"mocha": "^6.1.4", | ||
"nock": "^10.0.2", | ||
"nock": "^11.3.2", | ||
"sinon": "^7.3.2", | ||
@@ -61,0 +60,0 @@ "typescript": "^3.0.1" |
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
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
42552
13
10
403
+ Addedhttps-proxy-agent@3.0.1(transitive)
- Removedhttps-proxy-agent@2.2.4(transitive)
Updatedhttps-proxy-agent@^3.0.0