1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-08 14:57:35 +00:00

LibWeb: Treat all HTTP 4xx codes as errors

This commit is contained in:
Andreas Kling 2020-06-25 17:18:49 +02:00
parent 505b133fda
commit 4f7c7bbb09

View file

@ -172,9 +172,9 @@ void ResourceLoader::load(const URL& url, Function<void(const ByteBuffer&, const
error_callback("HTTP load failed");
return;
}
if (status_code.has_value() && status_code.value() == 404) {
if (status_code.has_value() && status_code.value() >= 400 && status_code.value() <= 499) {
if (error_callback)
error_callback("HTTP not found (four-oh-four!)");
error_callback(String("HTTP error (%u)", status_code.value()));
return;
}
success_callback(ByteBuffer::copy(payload.data(), payload.size()), response_headers);