1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 03:57:43 +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"); error_callback("HTTP load failed");
return; 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) if (error_callback)
error_callback("HTTP not found (four-oh-four!)"); error_callback(String("HTTP error (%u)", status_code.value()));
return; return;
} }
success_callback(ByteBuffer::copy(payload.data(), payload.size()), response_headers); success_callback(ByteBuffer::copy(payload.data(), payload.size()), response_headers);