- From: Jungkee Song <notifications@github.com>
- Date: Wed, 16 Mar 2016 22:14:33 -0700
- To: slightlyoff/ServiceWorker <ServiceWorker@noreply.github.com>
Received on Thursday, 17 March 2016 05:15:06 UTC
Basically, I wanted to avoid cloning the body not to require additional memory space. I still want to find a way. Do the following steps make sense? response: a Response object (resolved from a promise) passed to respondWith(r) 1. Let newResponse be a copy of response’s associated response, except for its body. 1. If response’s body is non-null, run these substeps: 1. Set newResponse's body to response's body. 1. Let dummyStream be an empty ReadableStream object. 1. Set response’s body to a new body whose stream is dummyStream. 1. Let reader be the result of getting a reader from dummyStream. 1. Read all bytes from dummyStream with reader. 1. Set the potential response to newResponse. `response.body` from the script surface seems okay since by the time `responseWith(r)` returns r's body should be disturbed already. Or, set the newResponse's body to the result of extracting the package data out of response's body's stream will do? --- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/slightlyoff/ServiceWorker/issues/850#issuecomment-197705711
Received on Thursday, 17 March 2016 05:15:06 UTC