diff --git a/lib/api/api-fetch.js b/lib/api/api-fetch.js index 3720719c155..a0d7107f01f 100644 --- a/lib/api/api-fetch.js +++ b/lib/api/api-fetch.js @@ -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') @@ -300,6 +299,7 @@ function normalizeAndValidateRequestMethod (method) { return normalizedMethod } +// https://fetch.spec.whatwg.org/#concept-bodyinit-extract function extractBody (body) { // TODO: FormBody @@ -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]