Skip to content

Commit

Permalink
fix: Response.error().ok === false
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmann100 committed Dec 11, 2023
1 parent af51956 commit 883299c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ Response.prototype.clone = function() {

Response.error = function() {
var response = new Response(null, {status: 200, statusText: ''})
response.ok = false
response.status = 0
response.type = 'error'
return response
Expand Down
1 change: 1 addition & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,7 @@ exercise.forEach(function(exerciseMode) {
test('error creates error Response', function() {
var r = Response.error()
assert(r instanceof Response)
assert.equal(r.ok, false)
assert.equal(r.status, 0)
assert.equal(r.statusText, '')
assert.equal(r.type, 'error')
Expand Down

0 comments on commit 883299c

Please sign in to comment.