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:
rmg-x 2024-12-05 19:22:15 -06:00 committed by Tim Ledbetter
parent de595b713d
commit fa28337817
Notes: github-actions[bot] 2024-12-06 06:10:33 +00:00
2 changed files with 28 additions and 0 deletions

View file

@ -0,0 +1 @@
PASS: WHF

View 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>