diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp index 2772d7b7ce..0996a42101 100644 --- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp +++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp @@ -493,8 +493,11 @@ DOM::ExceptionOr XMLHttpRequest::send(Optional bod auto byte_buffer = TRY(ByteBuffer::copy(blob->bytes())); request.set_body(byte_buffer); return {}; }, [](auto&) -> ErrorOr { return {}; })); - if (body_with_type->type.has_value()) - request.set_header("Content-Type", String { body_with_type->type->span() }); + 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)) + request.set_header("Content-Type", String { body_with_type->type->span() }); + } } for (auto& it : m_request_headers) request.set_header(it.key, it.value);