Last active
August 12, 2024 10:20
-
-
Save disintegrator/6f87feb54432e5dda0927acb290321bb to your computer and use it in GitHub Desktop.
Setting User-Agent header on the browser has surprising results
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Chromium bug: https://issues.chromium.org/issues/40450316 | |
const headers = new Headers(); | |
headers.set("user-agent", "fancy/1.0"); | |
console.log(headers.get("user-agent") == null); | |
// Prints: false | |
const req = new Request(''); | |
req.headers.set("user-agent", "fancy/1.0"); | |
console.log(req.headers.get("user-agent") == null); | |
// Prints: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment