[whatwg/fetch] upload progress return response.json()? (#389)

https://github.com/whatwg/fetch/issues/21

Okay, **Fetch API integrated with Streams** it`s really cool, but
from https://fetch.spec.whatwg.org/#fetch-api
```
function consume(response, total=0) {
  var reader = response.body.getReader()
  return pump()
  function pump() {
    return reader.read().then(({done, value}) => {
      if (done) {
        return response
      }
      total += value.byteLength
      log(`received ${value.byteLength} bytes (${total} bytes in total)`)
      return pump()
    })
  }
}

fetch("/music/pk/altes-kamuffel.flac", {method: 'POST', body: MYFormData})
  .then(response => consume(response))
  .then(response => return response.json() // "Already read" )
  .then((resultFromServer) => log(resultFromServer.file))
  .catch(e => log("something went wrong: " + e))
```

how return real response.json() from Server?

-- 
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/389

Received on Friday, 16 September 2016 17:36:09 UTC