mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 07:03:29 +00:00
39 lines
1.4 KiB
HTML
39 lines
1.4 KiB
HTML
<script src="../testing.js"></script>
|
|
|
|
<script id=response>
|
|
let response = new Response("Hello, World!");
|
|
testing.expectEqual(200, response.status);
|
|
testing.expectEqual("", response.statusText);
|
|
testing.expectEqual(true, response.ok);
|
|
testing.expectEqual("", response.url);
|
|
testing.expectEqual(false, response.redirected);
|
|
|
|
let response2 = new Response("Error occurred", {
|
|
status: 404,
|
|
statusText: "Not Found",
|
|
headers: {
|
|
"Content-Type": "text/plain",
|
|
"X-Custom": "test-value",
|
|
"Cache-Control": "no-cache"
|
|
}
|
|
});
|
|
testing.expectEqual(404, response2.status);
|
|
testing.expectEqual("Not Found", response2.statusText);
|
|
testing.expectEqual(false, response2.ok);
|
|
testing.expectEqual("text/plain", response2.headers.get("Content-Type"));
|
|
testing.expectEqual("test-value", response2.headers.get("X-Custom"));
|
|
testing.expectEqual("no-cache", response2.headers.get("cache-control"));
|
|
|
|
let response3 = new Response("Created", { status: 201, statusText: "Created" });
|
|
testing.expectEqual(201, response3.status);
|
|
testing.expectEqual("Created", response3.statusText);
|
|
testing.expectEqual(true, response3.ok);
|
|
|
|
let nullResponse = new Response(null);
|
|
testing.expectEqual(200, nullResponse.status);
|
|
testing.expectEqual("", nullResponse.statusText);
|
|
|
|
let emptyResponse = new Response("");
|
|
testing.expectEqual(200, emptyResponse.status);
|
|
</script>
|