Re: [w3c/ServiceWorker] Have "Handle Fetch" return the request body in addition to response (#1563)

@annevk commented on this pull request.



> @@ -2950,6 +2950,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
       :: |request|, a [=/request=]
       : Output
       :: |response|, a [=/response=]

```suggestion
      :: |response|, null or a [=/response=]
```

> @@ -2950,6 +2950,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
       :: |request|, a [=/request=]
       : Output
       :: |response|, a [=/response=]
+      :: |requestBody|, a [=/body=]

```suggestion
      :: |requestBody|, null or a [=/body=]
```

>        1. If |activeWorker|'s <a>state</a> is "`activating`", wait for |activeWorker|'s <a>state</a> to become "`activated`".
       1. If the result of running the [=Run Service Worker=] algorithm with |activeWorker| is *failure*, then set |handleFetchFailed| to true.
       1. Else:
           1. Set |workerRealm| to the [=relevant realm=] of the |activeWorker|'s [=service worker/global object=].
           1. Set |eventHandled| to [=a new promise=] in |workerRealm|.
           1. [=Queue a task=] |task| to run the following substeps:
               1. Let |e| be the result of <a>creating an event</a> with {{FetchEvent}}.
+              1. If |requestBody| is not null, then:
+                  1. Set |requestBody|'s [=Body/stream=] to the result of [=ReadableStream/create a proxy|creating a proxy=] for |requestBody|'s [=Body/stream=].

Shouldn't this happen much earlier? We need to essentially transfer the request body back. If we just return it there are no side effects for the service worker side and there need to be when it's backed by a stream, right?

-- 
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/pull/1563#pullrequestreview-585498544

Received on Monday, 8 February 2021 13:39:37 UTC