LibHTTP: Return a StringView from HTTP::normalize_header_value

This lets callers that do not need a string avoid a needless allocation.
All callers that do need a string will already either:

* Turn it into a ByteString themselves
* Pass this along to the isomorphic encoder
This commit is contained in:
Timothy Flynn
2026-02-26 14:51:41 -05:00
committed by Shannon Booth
parent 5fe1a70c8e
commit 0652a33043
Notes: github-actions[bot] 2026-02-26 21:29:09 +00:00
2 changed files with 2 additions and 2 deletions

View File

@@ -79,7 +79,7 @@ bool is_header_value(StringView header_value)
}
// https://fetch.spec.whatwg.org/#concept-header-value-normalize
ByteString normalize_header_value(StringView potential_value)
StringView normalize_header_value(StringView potential_value)
{
// To normalize a byte sequence potentialValue, remove any leading and trailing HTTP whitespace bytes from
// potentialValue.

View File

@@ -25,7 +25,7 @@ struct Header {
[[nodiscard]] bool is_header_name(StringView);
[[nodiscard]] bool is_header_value(StringView);
[[nodiscard]] ByteString normalize_header_value(StringView);
[[nodiscard]] StringView normalize_header_value(StringView);
[[nodiscard]] bool is_forbidden_request_header(Header const&);
[[nodiscard]] bool is_forbidden_response_header_name(StringView);