summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-10-16 18:04:46 +0200
committerLinus Groh <mail@linusgroh.de>2022-10-16 18:04:46 +0200
commit0ea4d228e6e49e78ddeef623a2799c772e820dd1 (patch)
tree45760a50cca0afad4a7c1dc22a8df5040acde70b
parent1c979889b2b6fa81495e7a1fbc22f56faaac1ab2 (diff)
downloadserenity-0ea4d228e6e49e78ddeef623a2799c772e820dd1.zip
LibWeb: Add missing body has_value() check in XMLHttpRequest::send()
-rw-r--r--Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp
index 067cb42aac..8244360fd2 100644
--- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp
+++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp
@@ -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");
}
}