-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Test cases where request body gets used before network fallback #27325
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
I think we should also test the service worker cloning the request or the stream? Those seem like the kind of cases that might get overlooked in a naïve implementation.
@@ -155,6 +155,12 @@ function handleIsHistoryNavigation(event) { | |||
event.respondWith(new Response(body)); | |||
} | |||
|
|||
function handleUseAndIgnore(event) { | |||
const request = event.request; | |||
request.text(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should assert the body value here as well or in a different test. Otherwise it's still unclear whether the server worker can read it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is tested elsewhere: see "FetchEvent#body is a ReadableStream" in fetch-event.https.html.
I added "clone-and-ignore" tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this looks good from my side modulo that nit. I'd like a service worker peer to also review this, e.g., @wanderview, @jakearchibald, or @asutherland.
service-workers/service-worker/resources/fetch-event-test-worker.js
Outdated
Show resolved
Hide resolved
…er.js Co-authored-by: Anne van Kesteren <[email protected]>
…hub.com/web-platform-tests/wpt into yhirano/streaming-upload-sw-passthrough
Added tests for whatwg/fetch#572. |
Also stop transmitting request's body in this scenario. Service worker PR: w3c/ServiceWorker#1563. Tests: web-platform-tests/wpt#27325. Fixes w3c/ServiceWorker#1560 and fixes #572.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! (I wasn't aware that going via a SW breaks XHR upload events, but I understand why)
Tests for whatwg/fetch#1144.