mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
This matches the behavior of other engines. Some CDNs that do content negotiation will fall back to non alpha-preserving formats if these values are not present.
33 lines
1017 B
HTML
33 lines
1017 B
HTML
<!DOCTYPE html>
|
|
<script src="../include.js"></script>
|
|
<script>
|
|
promiseTest(async () => {
|
|
const httpServer = httpTestServer();
|
|
|
|
// A 1x1 transparent PNG.
|
|
const transparentPng = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";
|
|
|
|
const url = await httpServer.createEcho("GET", "/image-accept-header-probe", {
|
|
status: 200,
|
|
headers: {
|
|
"Content-Type": "image/png",
|
|
},
|
|
body_encoding: "base64",
|
|
body: transparentPng,
|
|
});
|
|
|
|
const image = new Image();
|
|
await new Promise((resolve) => {
|
|
image.onload = resolve;
|
|
image.onerror = resolve;
|
|
image.src = url;
|
|
});
|
|
|
|
const echoUrl = new URL(url);
|
|
const response = await fetch(`${echoUrl.origin}/recorded-request-headers${echoUrl.pathname}`);
|
|
const headers = await response.json();
|
|
|
|
println(headers["Accept"][0]);
|
|
});
|
|
</script>
|