Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
tsctx authored May 2, 2024
1 parent dceabbc commit 24dbb17
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/core/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ function bodyLength (body) {
: null
} else if (isBlobLike(body)) {
return body.size != null ? body.size : null
} else if (Buffer.isBuffer(body)) {
} else if (isBuffer(body)) {
return body.byteLength
}

Expand Down Expand Up @@ -341,10 +341,12 @@ function parseRawHeaders (headers) {

return ret
}

function isBuffer (buffer) {
// See, https://github.com/mcollina/undici/pull/319
return buffer instanceof Uint8Array || Buffer.isBuffer(buffer)
}

function validateHandler (handler, method, upgrade) {
if (!handler || typeof handler !== 'object') {
throw new InvalidArgumentError('handler must be an object')
Expand Down

0 comments on commit 24dbb17

Please sign in to comment.