1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:17:44 +00:00

LibWeb: Trim leading and trailing HTTP whitespace bytes

The XMLHttpRequest specification specifices that header values should be
normalized by trimming leading and trailing HTTP whitespace bytes.
This commit is contained in:
Kenneth Myhra 2022-04-04 10:42:12 +02:00 committed by Linus Groh
parent fccea8888e
commit 1ca1a73d67
2 changed files with 3 additions and 2 deletions

View file

@ -406,8 +406,7 @@ static String normalize_method(String const& method)
// https://fetch.spec.whatwg.org/#concept-header-value-normalize
static String normalize_header_value(String const& header_value)
{
// FIXME: I'm not sure if this is the right trim, it should only be HTML whitespace bytes.
return header_value.trim_whitespace();
return header_value.trim(StringView { http_whitespace_bytes });
}
// https://xhr.spec.whatwg.org/#dom-xmlhttprequest-setrequestheader