LibWeb: Remove OOM propagation from Fetch::Infrastructure::Methods

This commit is contained in:
Timothy Flynn 2024-04-26 13:26:55 -04:00 committed by Andreas Kling
commit b3032befe0
Notes: sideshowbarker 2024-07-16 22:26:05 +09:00
4 changed files with 5 additions and 5 deletions

View file

@ -36,10 +36,10 @@ bool is_forbidden_method(ReadonlyBytes method)
}
// https://fetch.spec.whatwg.org/#concept-method-normalize
ErrorOr<ByteBuffer> normalize_method(ReadonlyBytes method)
ByteBuffer normalize_method(ReadonlyBytes method)
{
// To normalize a method, if it is a byte-case-insensitive match for `DELETE`, `GET`, `HEAD`, `OPTIONS`, `POST`, or `PUT`, byte-uppercase it.
auto bytes = TRY(ByteBuffer::copy(method));
auto bytes = MUST(ByteBuffer::copy(method));
if (StringView { method }.is_one_of_ignoring_ascii_case("DELETE"sv, "GET"sv, "HEAD"sv, "OPTIONS"sv, "POST"sv, "PUT"sv))
Infra::byte_uppercase(bytes);
return bytes;

View file

@ -13,6 +13,6 @@ namespace Web::Fetch::Infrastructure {
[[nodiscard]] bool is_method(ReadonlyBytes);
[[nodiscard]] bool is_cors_safelisted_method(ReadonlyBytes);
[[nodiscard]] bool is_forbidden_method(ReadonlyBytes);
[[nodiscard]] ErrorOr<ByteBuffer> normalize_method(ReadonlyBytes);
[[nodiscard]] ByteBuffer normalize_method(ReadonlyBytes);
}