Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workbox-range-requests should be a passthrough when given a 206 response #1720

Closed
jeffposnick opened this issue Oct 18, 2018 · 0 comments
Closed
Assignees
Labels
Breaking Change Denotes a "major" semver change. workbox-range-requests
Milestone

Comments

@jeffposnick
Copy link
Contributor

There's some movement to get the relevant specifications in place to have caches.match(), when passed a source Request containing a Range: header, automatically resolve with the correct partial HTTP 206 response.

That behavior is more or less what workbox-range-requests does already: it takes in a Request and Response pair, and returns a HTTP 206 Response with a body that reflects the Request's Range: (or a HTTP 416 if the response isn't long enough to satisfy the Range:).

The problem with the current workbox-range-requests behavior is that it assumes the source Response is always going to contain a complete Response body, not one that has already been sliced up. If it's passed a pre-sliced Response (due to browsers implementing changes to caches.match()), and then does it's own slicing, that's not going to lead to the proper response.

As a stop-gap, to prepare for a time when caches.match()'s behavior might change, I think a reasonable breaking change to workbox-range-requests's behavior, targeted for the v4 release, would be to first check the incoming Response object that it's passed, and if it already has a status of 206, just return it as-is. If it doesn't have a status of 206, then the existing logic will be applied.

I don't anticipate this affecting most current users today. Upgrading to workbox-range-requests v4 would be important if and when browsers start behaving differently, as using v3 would lead to double-slicing in updated browsers.

CC: @jakearchibald

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaking Change Denotes a "major" semver change. workbox-range-requests
Projects
None yet
Development

No branches or pull requests

2 participants