Re: [whatwg/fetch] How response bodies get from a service worker to the main page is not very clear (#330)

Thank you.

I would like to use a transform stream to explain that in the spec. Let me try:

Let `{ws, rs}` be a transform stream whose transform function

 - errors `rs` if an object that is not a Uint8Array object is written to `ws`,
 - detaches each written Uint8Array object, and
 - preserves the contents of written Uint8Array objects.

Note that each Uint8Array object's boundary needs not to be preserved, but the concatenation of all written bytes to `ws` needs to equal to the concatenation of all bytes that would be read from `rs`.

In `respondWith`, we need to create a response `r'` from the given response `r` by setting `r'`'s body stream to `rs` and calling `pipeTo` on `r`'s body stream with `ws`.

Does that make sense? Am I using streams' terminology correctly?

---
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/330#issuecomment-231947405

Received on Tuesday, 12 July 2016 06:18:54 UTC