LibWeb: Extract some CORS and MIME Fetch helpers to their own files

An upcoming commit will migrate the contents of Headers.h/cpp to LibHTTP
for use outside of LibWeb. These CORS and MIME helpers depend on other
LibWeb facilities, however, so they cannot be moved.
This commit is contained in:
Timothy Flynn 2025-11-26 13:32:39 -05:00 committed by Jelle Raaijmakers
parent 0fd80a8f99
commit 3dce6766a3
Notes: github-actions[bot] 2025-11-27 13:58:58 +00:00
30 changed files with 382 additions and 299 deletions

View file

@ -32,7 +32,9 @@
#include <LibWeb/Fetch/Infrastructure/FetchParams.h>
#include <LibWeb/Fetch/Infrastructure/FetchRecord.h>
#include <LibWeb/Fetch/Infrastructure/FetchTimingInfo.h>
#include <LibWeb/Fetch/Infrastructure/HTTP/CORS.h>
#include <LibWeb/Fetch/Infrastructure/HTTP/Headers.h>
#include <LibWeb/Fetch/Infrastructure/HTTP/MIME.h>
#include <LibWeb/Fetch/Infrastructure/HTTP/Methods.h>
#include <LibWeb/Fetch/Infrastructure/HTTP/Requests.h>
#include <LibWeb/Fetch/Infrastructure/HTTP/Responses.h>
@ -713,7 +715,7 @@ void fetch_response_handover(JS::Realm& realm, Infrastructure::FetchParams const
response_status = response.status();
// 2. Let mimeType be the result of extracting a MIME type from responses header list.
auto mime_type = response.header_list()->extract_mime_type();
auto mime_type = Infrastructure::extract_mime_type(response.header_list());
// 3. If mimeType is non-null, then set bodyInfos content type to the result of minimizing a supported MIME type given mimeType.
if (mime_type.has_value())