Skip to content

Commit

Permalink
Allow undefined Response status
Browse files Browse the repository at this point in the history
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 })
  • Loading branch information
remcohaszing committed Jun 16, 2017
1 parent 9a0c992 commit c3e1019
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fetch.js
Expand Up @@ -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)
Expand Down

0 comments on commit c3e1019

Please sign in to comment.