Skip to content

Commit

Permalink
fix: fetch extract TypeError
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed Aug 3, 2021
1 parent 1d560c4 commit f01d2ac
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/api/api-fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const util = require('../core/util')
const { AsyncResource } = require('async_hooks')
const { addSignal, removeSignal } = require('./abort-signal')
const { isBlob } = require('buffer')
const assert = require('assert')

const kStatus = Symbol('status')
const kUrlList = Symbol('url list')
Expand Down Expand Up @@ -300,6 +299,7 @@ function normalizeAndValidateRequestMethod (method) {
return normalizedMethod
}

// https://fetch.spec.whatwg.org/#concept-bodyinit-extract
function extractBody (body) {
// TODO: FormBody

Expand All @@ -322,13 +322,11 @@ function extractBody (body) {
typeof body.pipeTo === 'function' // web ReadableStream
) {
if (body.locked) {
// TODO: Standard says "Assert" but is unclear regarding what that means?
assert(false, 'locked')
throw new TypeError('locked')
}

if (util.isDisturbed(body)) {
// TODO: Standard says "Assert" but is unclear regarding what that means?
assert(false, 'disturbed')
throw new TypeError('disturbed')
}

return [body, null]
Expand Down

0 comments on commit f01d2ac

Please sign in to comment.