From c3e1019567262158f96309c8a9579adddaa7f894 Mon Sep 17 00:00:00 2001 From: Remco Haszing Date: Fri, 16 Jun 2017 14:11:19 +0200 Subject: [PATCH] Allow undefined Response status This allows the Response constructor to accept a status code that's explicitly set to undefined. Native fetch implementations in Chrome and Firefox behave this way. The following now works, but would previously throw an error: new Response('', { status: undefined }) --- fetch.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fetch.js b/fetch.js index f4755bd9..f2f466d7 100644 --- a/fetch.js +++ b/fetch.js @@ -380,7 +380,7 @@ } this.type = 'default' - this.status = 'status' in options ? options.status : 200 + this.status = options.status === undefined ? 200 : options.status this.ok = this.status >= 200 && this.status < 300 this.statusText = 'statusText' in options ? options.statusText : 'OK' this.headers = new Headers(options.headers)