LibWeb/Fetch: Add to_string function for Request::Mode

This commit is contained in:
Jamie Mansfield
2024-04-29 20:23:26 +01:00
committed by Andreas Kling
parent 3daba8970c
commit 6e3b2ce300
Notes: sideshowbarker 2024-07-18 04:38:32 +09:00
2 changed files with 18 additions and 0 deletions

View File

@@ -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();
}
}