Comparing version 4.11.0 to 4.11.1
@@ -6,3 +6,3 @@ // Ported from https://github.com/nodejs/undici/pull/907 | ||
const assert = require('assert') | ||
const { Readable } = require('stream') | ||
const { Readable, consumers } = require('stream') | ||
const { RequestAbortedError, NotSupportedError } = require('../core/errors') | ||
@@ -60,4 +60,4 @@ const util = require('../core/util') | ||
emit (ev, ...args) { | ||
// Waiting for: https://github.com/nodejs/node/pull/39589 | ||
if (ev === 'data') { | ||
// Node < 16.7 | ||
this._readableState.dataEmitted = true | ||
@@ -98,8 +98,7 @@ } else if (ev === 'error') { | ||
push (chunk) { | ||
if (this[kConsume] && chunk !== null && !this[kReading]) { | ||
if (this[kConsume] && chunk !== null) { | ||
consumePush(this[kConsume], chunk) | ||
return true | ||
} else { | ||
return super.push(chunk) | ||
return this[kReading] ? super.push(chunk) : true | ||
} | ||
return super.push(chunk) | ||
} | ||
@@ -109,3 +108,3 @@ | ||
async text () { | ||
return toUSVString(await consume(this, 'text')) | ||
return consume(this, 'text') | ||
} | ||
@@ -240,3 +239,3 @@ | ||
if (type === 'text') { | ||
resolve(Buffer.concat(body)) | ||
resolve(toUSVString(Buffer.concat(body))) | ||
} else if (type === 'json') { | ||
@@ -283,6 +282,8 @@ resolve(JSON.parse(Buffer.concat(body))) | ||
consume.type = null | ||
consume.stream = null | ||
consume.resolve = null | ||
consume.reject = null | ||
consume.resolve = null | ||
consume.decoder = null | ||
consume.length = 0 | ||
consume.body = null | ||
} |
@@ -172,3 +172,3 @@ 'use strict' | ||
// 8. If action is non-null, then run these steps in in parallel: | ||
if (action !== null) { | ||
if (action != null) { | ||
// Run action. | ||
@@ -175,0 +175,0 @@ let iterator |
@@ -156,3 +156,3 @@ // https://github.com/Ethan-Arrowood/undici-fetch | ||
args[0] !== undefined && | ||
!(typeof args[0] === 'object' && args[0] !== null) && | ||
!(typeof args[0] === 'object' && args[0] != null) && | ||
!Array.isArray(args[0]) | ||
@@ -159,0 +159,0 @@ ) { |
@@ -279,3 +279,3 @@ // https://github.com/Ethan-Arrowood/undici-fetch | ||
// body with error. | ||
if (request.body !== null) { | ||
if (request.body != null) { | ||
cancelBody(request.body, error) | ||
@@ -308,3 +308,3 @@ } | ||
// 3. If request’s client is non-null, then: | ||
if (request.client !== null) { | ||
if (request.client != null) { | ||
// 1. Set taskDestination to request’s client’s global object. | ||
@@ -379,3 +379,3 @@ taskDestination = request.client.globalObject | ||
// container to a clone of request’s client’s policy container. [HTML] | ||
if (request.client !== null) { | ||
if (request.client != null) { | ||
request.policyContainer = clonePolicyContainer( | ||
@@ -710,3 +710,3 @@ request.client.policyContainer | ||
// fetchParams’s task destination. | ||
if (fetchParams.processResponseDone !== null) { | ||
if (fetchParams.processResponseDone != null) { | ||
fetchParams.processResponseDone(response) | ||
@@ -723,3 +723,3 @@ } | ||
// given response, with fetchParams’s task destination. | ||
if (fetchParams.processResponse !== null) { | ||
if (fetchParams.processResponse != null) { | ||
fetchParams.processResponse(response) | ||
@@ -923,3 +923,3 @@ } | ||
actualResponse.status !== 303 && | ||
request.body !== null && | ||
request.body != null && | ||
request.body.source == null | ||
@@ -962,3 +962,3 @@ ) { | ||
// value of safely extracting request’s body’s source. | ||
if (request.body !== null) { | ||
if (request.body != null) { | ||
assert(request.body.source) | ||
@@ -1068,3 +1068,3 @@ request.body = safelyExtractBody(request.body.source)[0] | ||
// contentLength, serialized and isomorphic encoded. | ||
if (contentLength !== null) { | ||
if (contentLength != null) { | ||
// TODO: isomorphic encoded | ||
@@ -1077,3 +1077,3 @@ contentLengthHeaderValue = String(contentLength) | ||
// list. | ||
if (contentLengthHeaderValue !== null) { | ||
if (contentLengthHeaderValue != null) { | ||
httpRequest.headersList.append('content-length', contentLengthHeaderValue) | ||
@@ -1084,3 +1084,3 @@ } | ||
// then: | ||
if (contentLength !== null && httpRequest.keepalive) { | ||
if (contentLength != null && httpRequest.keepalive) { | ||
// NOTE: keepalive is a noop outside of browser context. | ||
@@ -1296,3 +1296,3 @@ } | ||
// request’s body is null, or request’s body is non-null and request’s body’s source is non-null | ||
(request.body == null || request.body.source !== null) | ||
(request.body == null || request.body.source != null) | ||
) { | ||
@@ -1299,0 +1299,0 @@ // then: |
@@ -126,3 +126,3 @@ /* globals AbortController */ | ||
// 10. If init["window"] exists and is non-null, then throw a TypeError. | ||
if ('window' in init && window !== null) { | ||
if ('window' in init && window != null) { | ||
throw new TypeError(`'window' option '${window}' must be null`) | ||
@@ -227,3 +227,3 @@ } | ||
// 18. If mode is non-null, set request’s mode to mode. | ||
if (mode !== null) { | ||
if (mode != null) { | ||
request.mode = mode | ||
@@ -774,3 +774,3 @@ } | ||
// result of cloning request’s body. | ||
if (request.body !== null) { | ||
if (request.body != null) { | ||
newRequest.body = cloneBody(request.body) | ||
@@ -777,0 +777,0 @@ } |
@@ -330,3 +330,3 @@ 'use strict' | ||
// result of cloning response’s body. | ||
if (response.body !== null) { | ||
if (response.body != null) { | ||
newResponse.body = cloneBody(response.body) | ||
@@ -333,0 +333,0 @@ } |
{ | ||
"name": "undici", | ||
"version": "4.11.0", | ||
"version": "4.11.1", | ||
"description": "An HTTP/1.1 client, written from scratch for Node.js", | ||
@@ -5,0 +5,0 @@ "homepage": "https://undici.nodejs.org", |
10170
640399