WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
284184
Checking for presence of request body in Service Worker causes body to be dropped from request
https://bugs.webkit.org/show_bug.cgi?id=284184
Summary
Checking for presence of request body in Service Worker causes body to be dro...
Wes
Reported
2024-12-06 12:35:26 PST
If a service worker intercepts a fetch request and checks for the presence of a body then the body will get dropped from the SW's fetch request. NOTE: I have tried this with both "Content-Type: application/json" and "Content-Type: x-www-form-urlencoded" and both hit this bug.
> // sw code > self.addEventListener("fetch", (event) => { > event.respondWith( > (async () => { > if (event.request.body) { > console.log("this request has a body"); > } > return fetch(event.request); > })() > ); >});
I have made a repro at
https://github.com/wes-goulet/webkit-service-worker-drop-body-repro
This same check of a request body causes no issue if it happens on the main thread (not in SW).
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2024-12-13 12:36:14 PST
<
rdar://problem/141454387
>
youenn fablet
Comment 2
2025-01-06 09:17:14 PST
Submitted web-platform-tests pull request:
https://github.com/web-platform-tests/wpt/pull/49923
EWS
Comment 3
2025-01-07 01:04:17 PST
Committed
288514@main
(6c800745251d): <
https://commits.webkit.org/288514@main
> Reviewed commits have been landed. Closing PR #38561 and removing active labels.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug