diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp index 314f12e2ff..5f5638f7dc 100644 --- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp +++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp @@ -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 diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h index c8a02a01fa..b556aed0b3 100644 --- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h +++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h @@ -19,6 +19,8 @@ namespace Web::XHR { +static constexpr Array http_whitespace_bytes = { '\t', '\n', '\r', ' ' }; + class XMLHttpRequest final : public RefCounted , public Weakable