diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp index 285259af87..83b70a21d3 100644 --- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp +++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp @@ -433,12 +433,19 @@ WebIDL::ExceptionOr XMLHttpRequest::send(Optionalpage()); request.set_method(m_method); if (body_with_type.has_value()) { - TRY_OR_RETURN_OOM(realm, body_with_type->body.source().visit([&](ByteBuffer const& buffer) -> ErrorOr { + TRY(body_with_type->body.source().visit( + [&](ByteBuffer const& buffer) -> WebIDL::ExceptionOr { request.set_body(buffer); - return {}; }, [&](JS::Handle const& blob) -> ErrorOr { - auto byte_buffer = TRY(ByteBuffer::copy(blob->bytes())); + return {}; + }, + [&](JS::Handle const& blob) -> WebIDL::ExceptionOr { + auto byte_buffer = TRY_OR_RETURN_OOM(realm, ByteBuffer::copy(blob->bytes())); request.set_body(byte_buffer); - return {}; }, [](auto&) -> ErrorOr { return {}; })); + return {}; + }, + [](auto&) -> WebIDL::ExceptionOr { + return {}; + })); if (body_with_type->type.has_value()) { // If type is non-null and this’s headers’s header list does not contain `Content-Type`, then append (`Content-Type`, type) to this’s headers. if (!m_request_headers.contains("Content-Type"sv))