-
Notifications
You must be signed in to change notification settings - Fork 572
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Uzlopak <5059100+Uzlopak@users.noreply.github.com>
- Loading branch information
1 parent
251da10
commit 45eaed2
Showing
11 changed files
with
133 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
test/fixtures/wpt/service-workers/service-worker/fetch-with-body.https.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<!DOCTYPE html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="resources/test-helpers.sub.js"></script> | ||
<body> | ||
<script> | ||
const SCRIPT = 'resources/fetch-with-body-worker.js'; | ||
const SCOPE = 'resources/blank.html'; | ||
|
||
let frame, registration; | ||
|
||
promise_test(async t => { | ||
t.add_cleanup(async() => { | ||
if (frame) | ||
frame.remove(); | ||
if (registration) | ||
await registration.unregister(); | ||
}); | ||
|
||
await service_worker_unregister(t, SCOPE); | ||
registration = await navigator.serviceWorker.register(SCRIPT, {scope: SCOPE}); | ||
await wait_for_state(t, registration.installing, 'activating'); | ||
frame = await with_iframe(SCOPE); | ||
|
||
const request1 = new Request("resources/fetch-with-body-worker.py", { | ||
method: "GET", | ||
}); | ||
|
||
const response1 = await frame.contentWindow.fetch(request1); | ||
assert_false(response1.ok); | ||
|
||
const request2 = new Request("resources/fetch-with-body-worker.py", { | ||
method: "POST", | ||
body: "BODY", | ||
headers: { "Content-Type": "text/ascii" }, | ||
}); | ||
|
||
const response2 = await frame.contentWindow.fetch(request2); | ||
assert_true(response2.ok); | ||
}, 'Validate body is preserved'); | ||
|
||
</script> | ||
</body> | ||
</html> |
4 changes: 4 additions & 0 deletions
4
test/fixtures/wpt/service-workers/service-worker/resources/fetch-with-body-worker.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
self.addEventListener("fetch", (event) => { | ||
event.request.body; | ||
event.respondWith(fetch(event.request)); | ||
}); |
4 changes: 4 additions & 0 deletions
4
test/fixtures/wpt/service-workers/service-worker/resources/fetch-with-body-worker.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
def main(request, response): | ||
if len(request.body): | ||
return 200, [], u"BODY" | ||
return 400, [], u"NO BODY" |