Comparing version 4.0.0-ts1 to 4.0.0-ts2
/// <reference types="node" /> | ||
import 'core-js/library'; | ||
import * as http from 'http'; | ||
import http = require('http'); | ||
export declare type Protocol = 'https:' | 'http:'; | ||
@@ -124,3 +124,3 @@ /** | ||
_getNextRange(): Promise<void>; | ||
_redactedHeaders(headers: http.IncomingHttpHeaders | http.OutgoingHttpHeaders): http.IncomingHttpHeaders | http.OutgoingHttpHeaders; | ||
_redactedHeaders(headers: http.IncomingHttpHeaders | http.OutgoingHttpHeaders): http.OutgoingHttpHeaders | http.IncomingHttpHeaders; | ||
readonly _responseOK: boolean; | ||
@@ -127,0 +127,0 @@ readonly _responseRedirect: boolean; |
@@ -14,6 +14,3 @@ "use strict"; | ||
const uri = require("url"); | ||
const http = require("http"); | ||
const https = require("https"); | ||
const proxy_1 = require("./proxy"); | ||
const isStream = require("is-stream"); | ||
const deps_1 = require("./deps"); | ||
const pjson = require('../package.json'); | ||
@@ -30,2 +27,5 @@ const debug = require('debug')('http'); | ||
} | ||
function stringOrFirstString(o) { | ||
return Array.isArray(o) ? o[0] : o; | ||
} | ||
function caseInsensitiveObject() { | ||
@@ -202,3 +202,3 @@ let lowercaseKey = (k) => (typeof k === 'string') ? k.toLowerCase() : k; | ||
this.options.path = u.path || '/'; | ||
this.options.agent = this.options.agent || proxy_1.default.agent(this.secure); | ||
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); | ||
@@ -305,9 +305,9 @@ } | ||
if (this.secure) { | ||
this.request = https.request(this.options, resolve); | ||
this.request = deps_1.deps.https.request(this.options, resolve); | ||
} | ||
else { | ||
this.request = http.request(this.options, resolve); | ||
this.request = deps_1.deps.http.request(this.options, resolve); | ||
} | ||
this.request.on('error', reject); | ||
if (this.options.body && isStream.readable(this.options.body)) { | ||
if (this.options.body && deps_1.deps.isStream.readable(this.options.body)) { | ||
this.options.body.pipe(this.request); | ||
@@ -323,3 +323,3 @@ } | ||
this.body = yield concat(this.response); | ||
let json = this.headers['content-type'] === 'application/json'; | ||
let json = deps_1.deps.mime.contentType(stringOrFirstString(this.headers['content-type'])) === deps_1.deps.mime.contentType('application/json'); | ||
if (json) | ||
@@ -330,3 +330,3 @@ this.body = JSON.parse(this.body); | ||
_parseBody(body) { | ||
if (isStream.readable(body)) { | ||
if (deps_1.deps.isStream.readable(body)) { | ||
this.options.body = body; | ||
@@ -333,0 +333,0 @@ return; |
{ | ||
"name": "http-call", | ||
"description": "make http requests", | ||
"version": "4.0.0-ts1", | ||
"version": "4.0.0-ts2", | ||
"author": "Jeff Dickey @jdxcode", | ||
"bugs": "https://github.com/jdxcode/http-call/issues", | ||
"dependencies": { | ||
"core-js": "^2.5.1", | ||
"debug": "^3.0.1", | ||
"is-retry-allowed": "^1.1.0", | ||
"is-stream": "^1.1.0", | ||
"mime-types": "^2.1.17", | ||
"tunnel-agent": "^0.6.0" | ||
@@ -16,2 +18,3 @@ }, | ||
"@types/jest": "^20.0.8", | ||
"@types/mime-types": "^2.1.0", | ||
"@types/nock": "^8.2.1", | ||
@@ -18,0 +21,0 @@ "@types/node": "^8.0.28", |
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
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
22689
8
633
6
12
4
5
+ Addedcore-js@^2.5.1
+ Addedmime-types@^2.1.17
+ Addedcore-js@2.6.12(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)