minipass-fetch
Advanced tools
Comparing version 1.2.1 to 1.3.0
@@ -108,3 +108,3 @@ 'use strict' | ||
if (this.body === null) { | ||
return Promise.resolve(Buffer.alloc(0)); | ||
return Promise.resolve(Buffer.alloc(0)) | ||
} | ||
@@ -119,3 +119,3 @@ | ||
if (!Minipass.isStream(upstream)) | ||
return Promise.resolve(Buffer.alloc(0)); | ||
return Promise.resolve(Buffer.alloc(0)) | ||
@@ -223,3 +223,3 @@ const stream = this.size && upstream instanceof MinipassSized ? upstream | ||
static writeToStream (dest, instance) { | ||
const {body} = instance; | ||
const {body} = instance | ||
@@ -247,3 +247,3 @@ if (body === null || body === undefined) | ||
text: { enumerable: true } | ||
}); | ||
}) | ||
@@ -250,0 +250,0 @@ |
@@ -12,3 +12,3 @@ 'use strict' | ||
const validateValue = value => { | ||
value = `${value}`; | ||
value = `${value}` | ||
if (invalidHeaderCharRegex.test(value)) | ||
@@ -89,3 +89,3 @@ throw new TypeError(`${value} is not a legal HTTP header value`) | ||
forEach (callback, thisArg = undefined) { | ||
let pairs = getHeaders(this); | ||
let pairs = getHeaders(this) | ||
for (let i = 0; i < pairs.length; i++) { | ||
@@ -184,3 +184,3 @@ const [name, value] = pairs[i] | ||
else | ||
headers[MAP][name].push(val); | ||
headers[MAP][name].push(val) | ||
} | ||
@@ -187,0 +187,0 @@ } else if (!invalidHeaderCharRegex.test(obj[name])) |
@@ -149,3 +149,3 @@ 'use strict' | ||
reject(new FetchError(`maximum redirect reached at: ${ | ||
request.url}`, 'max-redirect')); | ||
request.url}`, 'max-redirect')) | ||
finalize() | ||
@@ -152,0 +152,0 @@ return |
@@ -70,2 +70,22 @@ 'use strict' | ||
// TLS specific options that are handled by node | ||
const { | ||
ca, | ||
cert, | ||
ciphers, | ||
clientCertEngine, | ||
crl, | ||
dhparam, | ||
ecdhCurve, | ||
honorCipherOrder, | ||
key, | ||
passphrase, | ||
pfx, | ||
rejectUnauthorized = true, | ||
secureOptions, | ||
secureProtocol, | ||
servername, | ||
sessionIdContext, | ||
} = init | ||
this[INTERNALS] = { | ||
@@ -77,2 +97,18 @@ method, | ||
signal, | ||
ca, | ||
cert, | ||
ciphers, | ||
clientCertEngine, | ||
crl, | ||
dhparam, | ||
ecdhCurve, | ||
honorCipherOrder, | ||
key, | ||
passphrase, | ||
pfx, | ||
rejectUnauthorized, | ||
secureOptions, | ||
secureProtocol, | ||
servername, | ||
sessionIdContext, | ||
} | ||
@@ -92,19 +128,19 @@ | ||
get method() { | ||
return this[INTERNALS].method; | ||
return this[INTERNALS].method | ||
} | ||
get url() { | ||
return formatUrl(this[INTERNALS].parsedURL); | ||
return formatUrl(this[INTERNALS].parsedURL) | ||
} | ||
get headers() { | ||
return this[INTERNALS].headers; | ||
return this[INTERNALS].headers | ||
} | ||
get redirect() { | ||
return this[INTERNALS].redirect; | ||
return this[INTERNALS].redirect | ||
} | ||
get signal() { | ||
return this[INTERNALS].signal; | ||
return this[INTERNALS].signal | ||
} | ||
@@ -151,3 +187,3 @@ | ||
if (contentLengthValue) | ||
headers.set('Content-Length', contentLengthValue + ''); | ||
headers.set('Content-Length', contentLengthValue + '') | ||
@@ -167,4 +203,24 @@ // HTTP-network-or-cache fetch step 2.11 | ||
if (!headers.has('Connection') && !agent) | ||
headers.set('Connection', 'close'); | ||
headers.set('Connection', 'close') | ||
// TLS specific options that are handled by node | ||
const { | ||
ca, | ||
cert, | ||
ciphers, | ||
clientCertEngine, | ||
crl, | ||
dhparam, | ||
ecdhCurve, | ||
honorCipherOrder, | ||
key, | ||
passphrase, | ||
pfx, | ||
rejectUnauthorized, | ||
secureOptions, | ||
secureProtocol, | ||
servername, | ||
sessionIdContext, | ||
} = request[INTERNALS] | ||
// HTTP-network fetch step 4.2 | ||
@@ -178,2 +234,18 @@ // chunked encoding is handled by Node.js | ||
agent, | ||
ca, | ||
cert, | ||
ciphers, | ||
clientCertEngine, | ||
crl, | ||
dhparam, | ||
ecdhCurve, | ||
honorCipherOrder, | ||
key, | ||
passphrase, | ||
pfx, | ||
rejectUnauthorized, | ||
secureOptions, | ||
secureProtocol, | ||
servername, | ||
sessionIdContext, | ||
} | ||
@@ -180,0 +252,0 @@ } |
{ | ||
"name": "minipass-fetch", | ||
"version": "1.2.1", | ||
"version": "1.3.0", | ||
"description": "An implementation of window.fetch in Node.js using Minipass streams", | ||
@@ -30,3 +30,2 @@ "license": "MIT", | ||
"minipass": "^3.1.0", | ||
"minipass-pipeline": "^1.2.2", | ||
"minipass-sized": "^1.0.3", | ||
@@ -33,0 +32,0 @@ "minizlib": "^2.0.0" |
@@ -21,1 +21,10 @@ # minipass-fetch | ||
See [node-fetch](http://npm.im/node-fetch) | ||
Differences from `node-fetch` (and, by extension, from the WhatWG Fetch | ||
specification): | ||
- Returns [minipass](http://npm.im/minipass) streams instead of node-core | ||
streams. | ||
- Supports the full set of [TLS Options that may be provided to | ||
`https.request()`](https://nodejs.org/api/https.html#https_https_request_options_callback) | ||
when making `https` requests. |
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
41792
4
1175
30
- Removedminipass-pipeline@^1.2.2
- Removedminipass-pipeline@1.2.4(transitive)