[whatwg/fetch] Error-prone: "Response with null body status cannot have body" (#487)

We were trying to stub out the fetch API using XmlHttpRequest (so that we could access progress events).

We ran into a bug because some response codes are handled specially, so now we have code that looks like this:

```
       if (this._xhr.status == 101 || this._xhr.status == 204 || this._xhr.status == 205 || this._xhr.status == 304) {
         body = null
       } else if (this._xhr.response) {
          body = @_xhr.response
       } ...

      new Response(body, ...)
```

Is there a reason for special casing these response codes? It seems a rather nasty edge-case that everyone has to handle.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/487

Received on Monday, 13 February 2017 07:07:49 UTC