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

@yutakahirano commented on this pull request.



>        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=].

Which point do you think is the best?

Do you mean [transferring stream](https://github.com/whatwg/streams/issues/276) by "transfer"? I think what's needed is a bit different from that transferring as 

 - We don't keep chunk boundary.
 - Chunks other than Uint8Arrays are rejected.

I think we need to define a means to create such a Body and/or ReadableStream in the fetch spec, but I don't want it to block streaming upload - it is an existing problem for Response.body, too.


-- 
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#discussion_r572079946

Received on Monday, 8 February 2021 14:17:45 UTC