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

I tried looking over browser behavior and it seems they mostly allow reading from both the service worker and server (i.e., it doesn't get disturbed explicitly).

Here's intuitively what I think is the expected behavior:
* If the service worker doesn't touch request.body and does not call respondWith() , the request falls back with an intact body.
* If the service worker doesn't touch request.body and responds with Response.redirect(), the redirected request has the intact body.
* If the service worker touches request.body, it's disturbed and network fallback or redirect will result in a network error.
* Once dispatching the fetch event finishes, request.body inside the service worker is disturbed and touching it throws an error.

This might contradict https://github.com/w3c/ServiceWorker/issues/1191#issuecomment-326031249 though, and we might need to add some state to Request objects to disturb the body while the underlying request's body is not yet closed.

cc @yutakahirano who might have thoughts.

-- 
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#issuecomment-498936628

Received on Wednesday, 5 June 2019 04:45:36 UTC