[w3c/ServiceWorker] What happens to the request body if the fetch isn't handled? (#1191)

What happens if:

* POST request with body.
* The service worker does not call `respondWith`.
* After 100ms (using `waitUntil`) the service worker tries to read the body of the request.

It feels like the read should fail, since the body is used as part of making the default request.

[Test](https://cdn.rawgit.com/jakearchibald/d46b30b64049879be0bda1dea40d2451/raw/fdf12fcd390783c7bb0e9387c85b0d92fd371072/) – Both Firefox and Chrome allow the body to be read, as if it's a clone.

I'm not sure this behaviour is compatible with request body streams. Or, it isn't memory-friendly.

Also, what happens if:

* POST request with body.
* The service worker gets a lock on the request's stream, tries to read data.
* The service worker does not call `respondWith`.

It feels like this should result in a network error, as the browser won't be able to read from the stream.

[Test](https://cdn.rawgit.com/jakearchibald/d46b30b64049879be0bda1dea40d2451/raw/fdf12fcd390783c7bb0e9387c85b0d92fd371072/) – Both Firefox and Chrome allow the body to be read in the service worker, and allow the default request to happen.

Again, I think this is problematic with request body streams.

Shall we try and change this?

@annevk @wanderview 

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

Received on Wednesday, 30 August 2017 14:56:41 UTC