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

LibWeb: Port URL and URLSearchParams to new String

This commit is contained in:
Kenneth Myhra 2023-03-01 20:10:01 +01:00 committed by Linus Groh
parent 843c9d6cd7
commit 9da09e4fd3
12 changed files with 229 additions and 157 deletions

View file

@ -90,7 +90,8 @@ WebIDL::ExceptionOr<Infrastructure::BodyWithType> extract_body(JS::Realm& realm,
},
[&](JS::Handle<URL::URLSearchParams> const& url_search_params) -> WebIDL::ExceptionOr<void> {
// Set source to the result of running the application/x-www-form-urlencoded serializer with objects list.
source = url_search_params->to_deprecated_string().to_byte_buffer();
auto search_params_bytes = TRY(url_search_params->to_string()).bytes();
source = TRY_OR_THROW_OOM(vm, ByteBuffer::copy(search_params_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 {};