1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 02:37:42 +00:00

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.
This commit is contained in:
Kenneth Myhra 2022-07-14 19:56:25 +02:00 committed by Linus Groh
parent 4978f388c2
commit 42e76d8de9

View file

@ -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);