mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-22 09:12:13 -05:00
Tests/LibWeb: Add test for propagation of custom HTTP reason phrase
This commit adds an in-tree test for code added in a previous commit:
e89e084798
We want to make sure that the custom reason phrase is making it from
RequestServer to the "statusText" property in the XHR infrastructure.
This commit is contained in:
parent
de595b713d
commit
fa28337817
Notes:
github-actions[bot]
2024-12-06 06:10:33 +00:00
Author: https://github.com/rmg-x Commit: https://github.com/LadybirdBrowser/ladybird/commit/fa283378175 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2802 Reviewed-by: https://github.com/tcl3 ✅
2 changed files with 28 additions and 0 deletions
|
@ -0,0 +1 @@
|
||||||
|
PASS: WHF
|
27
Tests/LibWeb/Text/input/http-reason-phrase-propagation.html
Normal file
27
Tests/LibWeb/Text/input/http-reason-phrase-propagation.html
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
<script src="./include.js"></script>
|
||||||
|
<script>
|
||||||
|
asyncTest(async (done) => {
|
||||||
|
const expectedStatusText = "WHF";
|
||||||
|
|
||||||
|
try {
|
||||||
|
const httpServer = httpTestServer();
|
||||||
|
const url = await httpServer.createEcho("GET", "/http-reason-phrase-test", {
|
||||||
|
status: 200,
|
||||||
|
reason_phrase: expectedStatusText,
|
||||||
|
headers: {
|
||||||
|
"Access-Control-Allow-Origin": "*",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const result = await fetch(url);
|
||||||
|
const statusText = result.statusText;
|
||||||
|
|
||||||
|
if (statusText === expectedStatusText) {
|
||||||
|
println(`PASS: ${statusText}`);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
println("FAIL - " + err);
|
||||||
|
}
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
</script>
|
Loading…
Reference in a new issue