From 6e3b2ce300beba8b953bc80ac95096d4e7afd46a Mon Sep 17 00:00:00 2001 From: Jamie Mansfield Date: Mon, 29 Apr 2024 20:23:26 +0100 Subject: [PATCH] LibWeb/Fetch: Add to_string function for Request::Mode --- .../Fetch/Infrastructure/HTTP/Requests.cpp | 17 +++++++++++++++++ .../LibWeb/Fetch/Infrastructure/HTTP/Requests.h | 1 + 2 files changed, 18 insertions(+) diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.cpp b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.cpp index c8a7c239366..c52ac6bad52 100644 --- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.cpp @@ -418,4 +418,21 @@ StringView request_destination_to_string(Request::Destination destination) VERIFY_NOT_REACHED(); } +StringView request_mode_to_string(Request::Mode mode) +{ + switch (mode) { + case Request::Mode::SameOrigin: + return "same-origin"sv; + case Request::Mode::CORS: + return "cors"sv; + case Request::Mode::NoCORS: + return "no-cors"sv; + case Request::Mode::Navigate: + return "navigate"sv; + case Request::Mode::WebSocket: + return "websocket"sv; + } + VERIFY_NOT_REACHED(); +} + } diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.h b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.h index 08dcca2ff77..d1d25b2ec0d 100644 --- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.h +++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.h @@ -518,5 +518,6 @@ private: }; StringView request_destination_to_string(Request::Destination); +StringView request_mode_to_string(Request::Mode); }