diff --git a/lib/fetch/formdata.js b/lib/fetch/formdata.js index a957a80e02a..5975e26c1a0 100644 --- a/lib/fetch/formdata.js +++ b/lib/fetch/formdata.js @@ -61,14 +61,7 @@ class FormData { // The delete(name) method steps are to remove all entries whose name // is name from this’s entry list. - const next = [] - for (const entry of this[kState]) { - if (entry.name !== name) { - next.push(entry) - } - } - - this[kState] = next + this[kState] = this[kState].filter(entry => entry.name !== name) } get (name) { diff --git a/lib/fetch/request.js b/lib/fetch/request.js index 080a5d7bfa3..f3d63cca016 100644 --- a/lib/fetch/request.js +++ b/lib/fetch/request.js @@ -128,7 +128,7 @@ class Request { } // 10. If init["window"] exists and is non-null, then throw a TypeError. - if (init.window !== undefined && init.window != null) { + if (init.window != null) { throw new TypeError(`'window' option '${window}' must be null`) } @@ -427,7 +427,7 @@ class Request { // non-null, and request’s method is `GET` or `HEAD`, then throw a // TypeError. if ( - ((init.body !== undefined && init.body != null) || inputBody != null) && + (init.body != null || inputBody != null) && (request.method === 'GET' || request.method === 'HEAD') ) { throw new TypeError('Request with GET/HEAD method cannot have body.') @@ -437,7 +437,7 @@ class Request { let initBody = null // 36. If init["body"] exists and is non-null, then: - if (init.body !== undefined && init.body != null) { + if (init.body != null) { // 1. Let Content-Type be null. // 2. Set initBody and Content-Type to the result of extracting // init["body"], with keepalive set to request’s keepalive.