1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:18:11 +00:00

LibWeb: Add missing body has_value() check in XMLHttpRequest::send()

This commit is contained in:
Linus Groh 2022-10-16 18:04:46 +02:00
parent 1c979889b2
commit 0ea4d228e6

View file

@ -462,7 +462,7 @@ WebIDL::ExceptionOr<void> XMLHttpRequest::send(Optional<Variant<JS::Handle<DOM::
if (!m_request_headers.contains("Content-Type"sv)) {
if (body_with_type.has_value() && body_with_type->type.has_value()) {
request.set_header("Content-Type", String { body_with_type->type->span() });
} else if (body->has<JS::Handle<DOM::Document>>()) {
} else if (body.has_value() && body->has<JS::Handle<DOM::Document>>()) {
request.set_header("Content-Type", "text/html;charset=UTF-8");
}
}