- From: Tsuyoshi Horo <notifications@github.com>
- Date: Tue, 25 Nov 2014 03:05:39 -0800
- To: slightlyoff/ServiceWorker <ServiceWorker@noreply.github.com>
Received on Tuesday, 25 November 2014 11:06:10 UTC
In the current spec, we don't check the `used flag` of the response when `response.clone()` is called. So we can call `response.text()` and `response.clone()` synchronously. But `response.text()` starts reading the all stream of the response in parallel, and `clone()` creates a tee of the response. I think these two operations conflict with each other. To handle this conflict, we have two options. 1. Rejects the promise of ‘text()‘ when ‘clone()‘ is called. -> "error 1" 2. Throws exceptions when ‘clone()‘ is called if the `used flag` is set. -> "error2" ```JavaScript fetch("/").then(function(response){ response.text() .then(function(t){ console.log(t); }) .catch(function(){ console.log("error 1"); }); try { response.clone(); } catch (e) { console.log("error 2"); } }) ``` --- Reply to this email directly or view it on GitHub: https://github.com/slightlyoff/ServiceWorker/issues/568
Received on Tuesday, 25 November 2014 11:06:10 UTC