summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Myhra <kennethmyhra@gmail.com>2022-07-14 19:56:25 +0200
committerLinus Groh <mail@linusgroh.de>2022-07-18 14:57:58 +0100
commit42e76d8de9e172226661e6bdca3fa5a00a8370d4 (patch)
treec5de0f1dca4740148eee5a5729212a8d07a535a6
parent4978f388c2bae4f34ff2cf0eb6da231732e24f7b (diff)
downloadserenity-42e76d8de9e172226661e6bdca3fa5a00a8370d4.zip
LibWeb: Rename safely_extract_body() to extract_body()
We have not yet implemented safely_extract_body so renaming this to extract_body() and adding a spec link.
-rw-r--r--Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp
index 9ff16aa4e7..c8b78821dc 100644
--- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp
+++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp
@@ -310,7 +310,8 @@ Optional<MimeSniff::MimeType> XMLHttpRequest::extract_mime_type(Fetch::HeaderLis
return mime_type;
}
-static XMLHttpRequest::BodyWithType safely_extract_body(XMLHttpRequestBodyInit& body)
+// https://fetch.spec.whatwg.org/#concept-bodyinit-extract
+static XMLHttpRequest::BodyWithType extract_body(XMLHttpRequestBodyInit& body)
{
if (body.has<NonnullRefPtr<URL::URLSearchParams>>()) {
return {
@@ -464,7 +465,7 @@ DOM::ExceptionOr<void> XMLHttpRequest::send(Optional<XMLHttpRequestBodyInit> bod
if (m_method.is_one_of("GET"sv, "HEAD"sv))
body = {};
- auto body_with_type = body.has_value() ? safely_extract_body(body.value()) : XMLHttpRequest::BodyWithType {};
+ auto body_with_type = body.has_value() ? extract_body(body.value()) : XMLHttpRequest::BodyWithType {};
AK::URL request_url = m_window->associated_document().parse_url(m_url.to_string());
dbgln("XHR send from {} to {}", m_window->associated_document().url(), request_url);