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

LibWeb: Set Content-Type for data: URLs instead of checking MIME on load

This makes the loader more agnostic.

Additionally, this allows us to load tab in Ladybird with a 'data:' URL
containing parameters, as a Resource will now call
`mime_type_from_content_type` to extract the content type from MIME. :^)
This commit is contained in:
Karol Kosek 2023-07-06 19:25:35 +02:00 committed by Andreas Kling
parent 16836e7e62
commit f27b9b9563
2 changed files with 5 additions and 5 deletions

View file

@ -223,9 +223,12 @@ void ResourceLoader::load(LoadRequest& request, Function<void(ReadonlyBytes, Has
data = url.data_payload().to_byte_buffer();
}
HashMap<DeprecatedString, DeprecatedString, CaseInsensitiveStringTraits> response_headers;
response_headers.set("Content-Type", url.data_mime_type());
log_success(request);
Platform::EventLoopPlugin::the().deferred_invoke([data = move(data), success_callback = move(success_callback)] {
success_callback(data, {}, {});
Platform::EventLoopPlugin::the().deferred_invoke([data = move(data), response_headers = move(response_headers), success_callback = move(success_callback)] {
success_callback(data, response_headers, {});
});
return;
}