mirror of
https://github.com/RGBCube/serenity
synced 2025-05-19 00:45: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
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