- From: Rafał Lorenz <notifications@github.com>
- Date: Wed, 21 Jun 2017 22:49:10 -0700
- To: w3c/ServiceWorker <ServiceWorker@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/ServiceWorker/issues/1164@github.com>
Hi I have simple service worker, but my [Range header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range) is not being send even thought i can log it on request object. ```javascript self.addEventListener('fetch', async function(event) { if (event.request.headers.get("range")) { const response = await fetch(event.request.clone()); return event.respondWith(this.getPartialResponse(event.request, response)); } return event.respondWith(fetch(event.request)); } async getPartialResponse(req, res) { const pos = Number(/^bytes\=(\d+)\-$/g.exec(req.headers.get("range"))[1]); const ab = await res.arrayBuffer(); const headers = new Headers(res.headers); headers.append("Content-Range", `bytes ${pos}-${ab.byteLength - 1}/${ab.byteLength}`); headers.append("Content-Length", ab.byteLength - pos + 1); return new Response(ab.slice(pos), { status: 206, statusText: "Partial Content", headers }); } ``` Here you can see request one catched by service worker and the second one send to the api where you can notice the `Range` header is missing. Why ? My browser: `Chrome/59.0.3071.104` ![console 1](https://i.stack.imgur.com/jddiO.png) ![console 2](https://i.stack.imgur.com/5chlZ.png) -- 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/issues/1164
Received on Thursday, 22 June 2017 05:49:45 UTC