Comparing version 4.0.6 to 4.0.7
/// <reference types="node" /> | ||
import proxy = require('./proxy'); | ||
import contentType = require('content-type'); | ||
import http = require('http'); | ||
import https = require('https'); | ||
import proxy = require('./proxy'); | ||
export declare const deps: { | ||
@@ -7,0 +7,0 @@ readonly proxy: typeof proxy.ProxyUtil; |
@@ -27,2 +27,1 @@ "use strict"; | ||
} | ||
//# sourceMappingURL=deps.js.map |
@@ -24,3 +24,2 @@ /// <reference types="node" /> | ||
export declare class HTTP { | ||
"constructor": typeof HTTP; | ||
/** | ||
@@ -106,2 +105,4 @@ * make an http GET request | ||
options: FullHTTPRequestOptions; | ||
private _redirectRetries; | ||
private _errorRetries; | ||
readonly method: string; | ||
@@ -111,9 +112,8 @@ readonly statusCode: number; | ||
url: string; | ||
readonly headers: http.IncomingMessage["headers"]; | ||
readonly headers: http.IncomingMessage['headers']; | ||
readonly partial: boolean; | ||
readonly ctor: typeof HTTP; | ||
constructor(url: string, options?: HTTPRequestOptions); | ||
_request(): Promise<void>; | ||
_redirectRetries: number; | ||
_redirect(): Promise<void>; | ||
_errorRetries: number; | ||
_maybeRetry(err: Error): Promise<void>; | ||
@@ -124,5 +124,5 @@ _debugRequest(): void; | ||
_parse(): Promise<void>; | ||
_parseBody(body: Object): void; | ||
_parseBody(body: object): void; | ||
_getNextRange(): Promise<void>; | ||
_redactedHeaders(headers: http.IncomingHttpHeaders | http.OutgoingHttpHeaders): http.OutgoingHttpHeaders | http.IncomingHttpHeaders; | ||
_redactedHeaders(headers: http.IncomingHttpHeaders | http.OutgoingHttpHeaders): http.IncomingHttpHeaders | http.OutgoingHttpHeaders; | ||
readonly _responseOK: boolean; | ||
@@ -129,0 +129,0 @@ readonly _responseRedirect: boolean; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
const uri = require("url"); | ||
const util = require("util"); | ||
const uri = require("url"); | ||
const deps_1 = require("./deps"); | ||
@@ -19,3 +19,3 @@ const pjson = require('../package.json'); | ||
function caseInsensitiveObject() { | ||
let lowercaseKey = (k) => (typeof k === 'string') ? k.toLowerCase() : k; | ||
let lowercaseKey = (k) => (typeof k === 'string' ? k.toLowerCase() : k); | ||
return new Proxy({}, { | ||
@@ -37,6 +37,6 @@ get: (t, k) => { | ||
}, | ||
has: function (t, k) { | ||
has: (t, k) => { | ||
k = lowercaseKey(k); | ||
return k in t; | ||
} | ||
}, | ||
}); | ||
@@ -168,4 +168,4 @@ } | ||
headers: { | ||
'user-agent': `${pjson.name}/${pjson.version} node-${process.version}` | ||
} | ||
'user-agent': `${pjson.name}/${pjson.version} node-${process.version}`, | ||
}, | ||
}; | ||
@@ -190,6 +190,6 @@ } | ||
this.options.protocol = u.protocol || this.options.protocol; | ||
this.options.host = u.hostname || this.constructor.defaultOptions.host || 'localhost'; | ||
this.options.host = u.hostname || this.ctor.defaultOptions.host || 'localhost'; | ||
this.options.path = u.path || '/'; | ||
this.options.agent = this.options.agent || deps_1.deps.proxy.agent(this.secure); | ||
this.options.port = u.port || this.constructor.defaultOptions.port || (this.secure ? 443 : 80); | ||
this.options.port = u.port || this.ctor.defaultOptions.port || (this.secure ? 443 : 80); | ||
} | ||
@@ -206,4 +206,7 @@ get headers() { | ||
} | ||
get ctor() { | ||
return this.constructor; | ||
} | ||
constructor(url, options = {}) { | ||
this.options = (Object.assign({}, this.constructor.defaultOptions, options, { headers: lowercaseHeaders(Object.assign({}, this.constructor.defaultOptions.headers, options.headers)) })); | ||
this.options = Object.assign({}, this.ctor.defaultOptions, options, { headers: lowercaseHeaders(Object.assign({}, this.ctor.defaultOptions.headers, options.headers)) }); | ||
if (!url) | ||
@@ -272,2 +275,3 @@ throw new Error('no url provided'); | ||
let noise = Math.random() * 100; | ||
// tslint:disable-next-line | ||
yield this._wait((1 << this._errorRetries) * 100 + noise); | ||
@@ -338,3 +342,3 @@ yield this._request(); | ||
const next = this.headers['next-range']; | ||
this.options.headers['range'] = Array.isArray(next) ? next[0] : next; | ||
this.options.headers.range = Array.isArray(next) ? next[0] : next; | ||
let prev = this.body; | ||
@@ -384,2 +388,1 @@ yield this._request(); | ||
exports.HTTPError = HTTPError; | ||
//# sourceMappingURL=http.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const uri = require("url"); | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
const uri = require("url"); | ||
class ProxyUtil { | ||
static get httpProxy() { return this.env.HTTP_PROXY || this.env.http_proxy; } | ||
static get httpsProxy() { return this.env.HTTPS_PROXY || this.env.https_proxy; } | ||
static get httpProxy() { | ||
return this.env.HTTP_PROXY || this.env.http_proxy; | ||
} | ||
static get httpsProxy() { | ||
return this.env.HTTPS_PROXY || this.env.https_proxy; | ||
} | ||
static get usingProxy() { | ||
@@ -28,5 +32,3 @@ if (this.httpProxy || this.httpsProxy) | ||
let filenames = this.sslCertFile.concat(this.sslCertDir); | ||
return filenames.map(function (filename) { | ||
return fs.readFileSync(filename); | ||
}); | ||
return filenames.map((filename) => fs.readFileSync(filename)); | ||
} | ||
@@ -36,3 +38,3 @@ static agent(https) { | ||
return; | ||
const u = https ? (this.httpsProxy || this.httpProxy) : this.httpProxy; | ||
const u = https ? this.httpsProxy || this.httpProxy : this.httpProxy; | ||
if (u) { | ||
@@ -45,4 +47,4 @@ let proxyParsed = uri.parse(u); | ||
host: proxyParsed.hostname, | ||
port: proxyParsed.port || '8080' | ||
} | ||
port: proxyParsed.port || '8080', | ||
}, | ||
}; | ||
@@ -65,2 +67,1 @@ if (proxyParsed.auth) { | ||
exports.default = ProxyUtil; | ||
//# sourceMappingURL=proxy.js.map |
{ | ||
"name": "http-call", | ||
"description": "make http requests", | ||
"version": "4.0.6", | ||
"version": "4.0.7", | ||
"author": "Jeff Dickey @jdxcode", | ||
@@ -10,3 +10,3 @@ "bugs": "https://github.com/heroku/http-call/issues", | ||
"debug": "^3.1.0", | ||
"is-retry-allowed": "^1.1.0", | ||
"is-retry-allowed": "git+https://github.com/heroku/is-retry-allowed", | ||
"is-stream": "^1.1.0", | ||
@@ -17,12 +17,17 @@ "tslib": "^1.8.1", | ||
"devDependencies": { | ||
"@cli-engine/util": "^1.0.13", | ||
"@heroku-cli/tslint": "^1.1.2", | ||
"@types/content-type": "1.1.2", | ||
"@types/is-stream": "^1.1.0", | ||
"@types/jest": "^21.1.9", | ||
"@types/nock": "^9.1.0", | ||
"@types/node": "^8.5.2", | ||
"@types/jest": "^22.0.1", | ||
"@types/nock": "^9.1.1", | ||
"@types/node": "^8.5.7", | ||
"del-cli": "^1.1.0", | ||
"husky": "^0.14.3", | ||
"jest": "^22.0.4", | ||
"nock": "^9.1.5", | ||
"prettier": "^1.9.2", | ||
"standard": "^10.0.3", | ||
"ts-jest": "^22.0.0", | ||
"ts-jest": "^22.0.1", | ||
"tslint": "^5.8.0", | ||
"typescript": "^2.6.2" | ||
@@ -37,15 +42,2 @@ }, | ||
"homepage": "https://github.com/heroku/http-call", | ||
"jest": { | ||
"coverageReporters": [ | ||
"json" | ||
], | ||
"transform": { | ||
"^.+\\.ts$": "<rootDir>/node_modules/ts-jest/preprocessor.js" | ||
}, | ||
"testRegex": "\\.test\\.ts$", | ||
"moduleFileExtensions": [ | ||
"js", | ||
"ts" | ||
] | ||
}, | ||
"keywords": [ | ||
@@ -60,5 +52,6 @@ "http", | ||
"scripts": { | ||
"precommit": "lint-staged", | ||
"prepare": "del-cli lib && tsc && del-cli 'lib/**/*.test.js' 'lib/**/*.test.d.ts'", | ||
"pretest": "tsc --sourcemap", | ||
"posttest": "cli-engine-util", | ||
"precommit": "cli-engine-util", | ||
"prepare": "cli-engine-util", | ||
"pretest": "tsc", | ||
"test": "jest" | ||
@@ -65,0 +58,0 @@ }, |
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
Git dependency
Supply chain riskContains a dependency which resolves to a remote git URL. Dependencies fetched from git URLs are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
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
21921
16
8
627
1
6
- Removedis-retry-allowed@1.2.0(transitive)
Updatedis-retry-allowed@git+https://github.com/heroku/is-retry-allowed