mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 18:20:43 +09:00
LibHTTP: Make HttpRequest
return its method name as a StringView
This commit is contained in:
parent
163ddf1d73
commit
b46667639f
Notes:
sideshowbarker
2024-07-17 03:18:29 +09:00
Author: https://github.com/LucasChollet
Commit: b46667639f
Pull-request: https://github.com/SerenityOS/serenity/pull/19764
Reviewed-by: https://github.com/alimpfard ✅
Reviewed-by: https://github.com/gmta ✅
Reviewed-by: https://github.com/shannonbooth
3 changed files with 16 additions and 16 deletions
|
@ -12,35 +12,35 @@
|
|||
|
||||
namespace HTTP {
|
||||
|
||||
DeprecatedString to_deprecated_string(HttpRequest::Method method)
|
||||
StringView to_string_view(HttpRequest::Method method)
|
||||
{
|
||||
switch (method) {
|
||||
case HttpRequest::Method::GET:
|
||||
return "GET";
|
||||
return "GET"sv;
|
||||
case HttpRequest::Method::HEAD:
|
||||
return "HEAD";
|
||||
return "HEAD"sv;
|
||||
case HttpRequest::Method::POST:
|
||||
return "POST";
|
||||
return "POST"sv;
|
||||
case HttpRequest::Method::DELETE:
|
||||
return "DELETE";
|
||||
return "DELETE"sv;
|
||||
case HttpRequest::Method::PATCH:
|
||||
return "PATCH";
|
||||
return "PATCH"sv;
|
||||
case HttpRequest::Method::OPTIONS:
|
||||
return "OPTIONS";
|
||||
return "OPTIONS"sv;
|
||||
case HttpRequest::Method::TRACE:
|
||||
return "TRACE";
|
||||
return "TRACE"sv;
|
||||
case HttpRequest::Method::CONNECT:
|
||||
return "CONNECT";
|
||||
return "CONNECT"sv;
|
||||
case HttpRequest::Method::PUT:
|
||||
return "PUT";
|
||||
return "PUT"sv;
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
DeprecatedString HttpRequest::method_name() const
|
||||
StringView HttpRequest::method_name() const
|
||||
{
|
||||
return to_deprecated_string(m_method);
|
||||
return to_string_view(m_method);
|
||||
}
|
||||
|
||||
ErrorOr<ByteBuffer> HttpRequest::to_raw_request() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue