Comparing version 4.12.0 to 4.12.1
@@ -12,3 +12,3 @@ 'use strict' | ||
kRemoveClient, | ||
kDispatch | ||
kGetDispatcher | ||
} = require('./pool-base') | ||
@@ -69,3 +69,3 @@ const Pool = require('./pool') | ||
[kDispatch] () { | ||
[kGetDispatcher] () { | ||
// We validate that pools is greater than 0, | ||
@@ -72,0 +72,0 @@ // otherwise we would have to wait until an upstream |
@@ -1019,3 +1019,3 @@ 'use strict' | ||
function onSocketReadable (data) { | ||
function onSocketReadable () { | ||
const { [kParser]: parser } = this | ||
@@ -1022,0 +1022,0 @@ parser.readMore() |
@@ -266,3 +266,7 @@ 'use strict' | ||
function isReadable (body) { | ||
return !!(body && /state: 'readable'/.test(nodeUtil.inspect(body))) | ||
return !!(body && ( | ||
stream.isReadable | ||
? stream.isReadable(body) | ||
: /state: 'readable'/.test(nodeUtil.inspect(body) | ||
))) | ||
} | ||
@@ -269,0 +273,0 @@ |
@@ -49,2 +49,3 @@ // https://github.com/Ethan-Arrowood/undici-fetch | ||
const { isErrored, isReadable } = require('../core/util') | ||
const { kIsMockActive } = require('../mock/mock-symbols') | ||
@@ -1625,3 +1626,3 @@ let ReadableStream | ||
method: request.method, | ||
body, | ||
body: context.dispatcher[kIsMockActive] ? request.body && request.body.source : body, | ||
headers: request.headersList, | ||
@@ -1628,0 +1629,0 @@ maxRedirections: 0 |
'use strict' | ||
const { MockNotMatchedError } = require('./mock-errors') | ||
const { kHeadersList } = require('../core/symbols') | ||
const { | ||
@@ -33,4 +34,7 @@ kDispatches, | ||
} | ||
for (const [matchHeaderName, matchHeaderValue] of Object.entries(mockDispatch.headers)) { | ||
if (!matchValue(matchHeaderValue, headers[matchHeaderName])) { | ||
const header = typeof headers.get === 'function' ? headers.get(matchHeaderName) : headers[matchHeaderName] | ||
if (!matchValue(matchHeaderValue, header)) { | ||
return false | ||
@@ -37,0 +41,0 @@ } |
@@ -23,3 +23,3 @@ 'use strict' | ||
const kQueued = Symbol('queued') | ||
const kDispatch = Symbol('dispatch') | ||
const kGetDispatcher = Symbol('get dispatcher') | ||
const kAddClient = Symbol('add client') | ||
@@ -194,3 +194,3 @@ const kRemoveClient = Symbol('remove client') | ||
const dispatcher = this[kDispatch]() | ||
const dispatcher = this[kGetDispatcher]() | ||
@@ -203,7 +203,3 @@ if (!dispatcher) { | ||
dispatcher[kNeedDrain] = true | ||
this[kNeedDrain] = this[kClients].some(dispatcher => ( | ||
!dispatcher[kNeedDrain] && | ||
dispatcher.closed !== true && | ||
dispatcher.destroyed !== true | ||
)) | ||
this[kNeedDrain] = !this[kGetDispatcher]() | ||
} | ||
@@ -263,3 +259,3 @@ } catch (err) { | ||
kRemoveClient, | ||
kDispatch | ||
kGetDispatcher | ||
} |
@@ -8,3 +8,3 @@ 'use strict' | ||
kAddClient, | ||
kDispatch | ||
kGetDispatcher | ||
} = require('./pool-base') | ||
@@ -68,3 +68,3 @@ const Client = require('./client') | ||
[kDispatch] () { | ||
[kGetDispatcher] () { | ||
let dispatcher = this[kClients].find(dispatcher => !dispatcher[kNeedDrain]) | ||
@@ -71,0 +71,0 @@ |
{ | ||
"name": "undici", | ||
"version": "4.12.0", | ||
"version": "4.12.1", | ||
"description": "An HTTP/1.1 client, written from scratch for Node.js", | ||
@@ -5,0 +5,0 @@ "homepage": "https://undici.nodejs.org", |
642634
10212