Re: [whatwg/fetch] Copy priority so service worker pass-through requests don't lose it (#785)

It would be great if priorities could be copied from one request to another even when modifying the URL of the request in the Service Worker.

Maybe pass the original request in the init object of Request() and copy its priority or something like this?

```
addEventListener('fetch', event => {
  const newURL = new URL(event.request.url);
  newURL.searchParams.append('fromSW', 1);
  
  const newRequest = new Request(newURL, { request: event.request });

  event.respondWith(fetch(newRequest))
});
```

Maybe considering the request destination when assigning a new priority could help also. Unfortunately, the destination is read-only :(

-- 
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/pull/785#issuecomment-412021352

Received on Friday, 10 August 2018 08:55:40 UTC