1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:28:11 +00:00

LibWeb: Use "POST" instead of "post" for POST resources in navigables

HTTP methods are case sensitive and the Fetch layer treats it as such.
For example, http_redirect_fetch case sensitively checks if the method
is "POST" to change the method to "GET" and nullify the body.
9d7e217566/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp (L1125-L1135)

Fixes https://github.com/SerenityOS/serenity/issues/21347
This commit is contained in:
Luke Wilde 2023-10-14 18:55:18 +01:00 committed by Tim Flynn
parent 9d7e217566
commit 7467307377

View file

@ -583,7 +583,7 @@ static WebIDL::ExceptionOr<Variant<Empty, NavigationParams, NonFetchSchemeNaviga
// 4. If documentResource is a POST resource, then:
if (document_resource.has<POSTResource>()) {
// 1. Set request's method to `POST`.
request->set_method(TRY_OR_THROW_OOM(vm, ByteBuffer::copy("post"sv.bytes())));
request->set_method(TRY_OR_THROW_OOM(vm, ByteBuffer::copy("POST"sv.bytes())));
// 2. Set request's body to documentResource's request body.
request->set_body(document_resource.get<POSTResource>().request_body.value());