diff --git a/Tests/LibWeb/Text/expected/fetch-request-url-search-params.txt b/Tests/LibWeb/Text/expected/fetch-request-url-search-params.txt new file mode 100644 index 00000000000..5b4f52faeaf --- /dev/null +++ b/Tests/LibWeb/Text/expected/fetch-request-url-search-params.txt @@ -0,0 +1 @@ +username=buggie&password=hunter2 diff --git a/Tests/LibWeb/Text/input/fetch-request-url-search-params.html b/Tests/LibWeb/Text/input/fetch-request-url-search-params.html new file mode 100644 index 00000000000..67503506239 --- /dev/null +++ b/Tests/LibWeb/Text/input/fetch-request-url-search-params.html @@ -0,0 +1,16 @@ + + diff --git a/Userland/Libraries/LibWeb/Fetch/BodyInit.cpp b/Userland/Libraries/LibWeb/Fetch/BodyInit.cpp index f9fb1acaac6..77cb4186ddd 100644 --- a/Userland/Libraries/LibWeb/Fetch/BodyInit.cpp +++ b/Userland/Libraries/LibWeb/Fetch/BodyInit.cpp @@ -105,8 +105,8 @@ WebIDL::ExceptionOr extract_body(JS::Realm& realm, }, [&](JS::Handle const& url_search_params) -> WebIDL::ExceptionOr { // Set source to the result of running the application/x-www-form-urlencoded serializer with object’s list. - auto search_params_bytes = TRY(url_search_params->to_string()).bytes(); - source = TRY_OR_THROW_OOM(vm, ByteBuffer::copy(search_params_bytes)); + auto search_params_string = TRY(url_search_params->to_string()); + source = TRY_OR_THROW_OOM(vm, ByteBuffer::copy(search_params_string.bytes())); // Set type to `application/x-www-form-urlencoded;charset=UTF-8`. type = TRY_OR_THROW_OOM(vm, ByteBuffer::copy("application/x-www-form-urlencoded;charset=UTF-8"sv.bytes())); return {};