mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-12 12:01:52 +00:00
30 lines
1.1 KiB
HTML
30 lines
1.1 KiB
HTML
<!DOCTYPE html>
|
|
<script src="./include.js"></script>
|
|
<script>
|
|
asyncTest(async (done) => {
|
|
try {
|
|
const httpServer = httpTestServer();
|
|
const url = await httpServer.createEcho("GET", "/test-http-test-server", {
|
|
status: 200,
|
|
headers: {
|
|
"Access-Control-Allow-Origin": "*", // necessary when running test using file://...
|
|
"Access-Control-Expose-Headers": "X-Custom-Header", // tells the browser which headers to expose to JS
|
|
"Content-Type": "text/plain",
|
|
"X-Custom-Header": "well hello friends",
|
|
},
|
|
body: "hello world!",
|
|
});
|
|
const result = await fetch(url);
|
|
const headers = result.headers;
|
|
|
|
if (headers.get("X-Custom-Header") === "well hello friends") {
|
|
println("PASS");
|
|
} else {
|
|
println("FAIL");
|
|
}
|
|
} catch (err) {
|
|
println("FAIL - " + err);
|
|
}
|
|
done();
|
|
});
|
|
</script>
|