mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 07:07:23 +00:00
LibHTTP: Make HTTP method names more accessible
Previously you could only get the name of an HttpRequest::Method if you already had an HttpRequest.
This commit is contained in:
committed by
Andreas Kling
parent
84953c5020
commit
9b891a423b
@@ -12,32 +12,37 @@
|
||||
|
||||
namespace HTTP {
|
||||
|
||||
String HttpRequest::method_name() const
|
||||
String to_string(HttpRequest::Method method)
|
||||
{
|
||||
switch (m_method) {
|
||||
case Method::GET:
|
||||
switch (method) {
|
||||
case HttpRequest::Method::GET:
|
||||
return "GET";
|
||||
case Method::HEAD:
|
||||
case HttpRequest::Method::HEAD:
|
||||
return "HEAD";
|
||||
case Method::POST:
|
||||
case HttpRequest::Method::POST:
|
||||
return "POST";
|
||||
case Method::DELETE:
|
||||
case HttpRequest::Method::DELETE:
|
||||
return "DELETE";
|
||||
case Method::PATCH:
|
||||
case HttpRequest::Method::PATCH:
|
||||
return "PATCH";
|
||||
case Method::OPTIONS:
|
||||
case HttpRequest::Method::OPTIONS:
|
||||
return "OPTIONS";
|
||||
case Method::TRACE:
|
||||
case HttpRequest::Method::TRACE:
|
||||
return "TRACE";
|
||||
case Method::CONNECT:
|
||||
case HttpRequest::Method::CONNECT:
|
||||
return "CONNECT";
|
||||
case Method::PUT:
|
||||
case HttpRequest::Method::PUT:
|
||||
return "PUT";
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
String HttpRequest::method_name() const
|
||||
{
|
||||
return to_string(m_method);
|
||||
}
|
||||
|
||||
ByteBuffer HttpRequest::to_raw_request() const
|
||||
{
|
||||
StringBuilder builder;
|
||||
|
||||
Reference in New Issue
Block a user