ladybird/Tests/LibWeb/Text/input/http-reason-phrase-propagation.html
rmg-x fa28337817 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.
2024-12-06 06:09:44 +00:00

27 lines
789 B
HTML

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