mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-03 23:52:08 +00:00
LibWeb: Ensure fetch errors set their response types/codes appropriately
If we fail to set the response type to an error, calling code will think the fetch was successful. We also should not default to an error code of 200, which would also indicate success.
This commit is contained in:
parent
26230f2ffd
commit
ddb4137ed4
Notes:
sideshowbarker
2024-07-17 01:13:25 +09:00
Author: https://github.com/trflynn89
Commit: ddb4137ed4
Pull-request: https://github.com/SerenityOS/serenity/pull/18181
Reviewed-by: https://github.com/linusg
1 changed files with 2 additions and 1 deletions
|
@ -1668,7 +1668,8 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> nonstandard_resource_load
|
|||
if (status_code.value_or(0) == 0) {
|
||||
response = Infrastructure::Response::network_error(vm, TRY_OR_IGNORE("HTTP request failed"_string));
|
||||
} else {
|
||||
response->set_status(status_code.value_or(200));
|
||||
response->set_type(Infrastructure::Response::Type::Error);
|
||||
response->set_status(status_code.value_or(400));
|
||||
// FIXME: Set response status message and body
|
||||
}
|
||||
pending_response->resolve(response);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue