Re: [whatwg] Fetch API Polyfill

On Tue, Oct 14, 2014 at 6:08 PM, David Graham
<david.malcom.graham@gmail.com> wrote:
> Interesting—thanks for the clarification. I've updated the example from this
>
>     fetch('/users.html').then(function(response) {
>       document.body.innerHTML = response.body
>     })
>
> to this
>
>     fetch('/users.html')
>       .then(function(response) {
>         return response.text()
>       }).then(function(body) {
>         document.body.innerHTML = body
>       })

That looks good.


> Should `response.body` ever be used directly or only accessed through
> one of the response body promises (json, text, blob, arrayBuffer,
> formData)?

At the moment there is no member named "body" (it was recently
removed). It will likely return in the future once
https://streams.spec.whatwg.org/ is stable enough.


-- 
https://annevankesteren.nl/

Received on Tuesday, 14 October 2014 16:43:53 UTC