W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2014

Re: [whatwg] Fetch API Polyfill

From: Anne van Kesteren <annevk@annevk.nl>
Date: Tue, 14 Oct 2014 18:43:29 +0200
Message-ID: <CADnb78g+6NrjORydhfcpCdJ4qnyUoyTpC7_bT0V1xKp_izAk_w@mail.gmail.com>
To: David Graham <david.malcom.graham@gmail.com>
Cc: WHATWG <whatwg@whatwg.org>
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

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:24 UTC