Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Gogs committed Feb 27, 2018
1 parent a3bc630 commit 6609b3b
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,39 @@ namespace cinatra {
constexpr inline auto TRACE = http_method::TRACE;
constexpr inline auto OPTIONS = http_method::OPTIONS;

inline constexpr std::string_view method_name(http_method mthd) {
switch (mthd)
{
case cinatra::http_method::DEL:
return "DELETE"sv;
break;
case cinatra::http_method::GET:
return "GET"sv;
break;
case cinatra::http_method::HEAD:
return "HEAD"sv;
break;
case cinatra::http_method::POST:
return "POST"sv;
break;
case cinatra::http_method::PUT:
return "PUT"sv;
break;
case cinatra::http_method::CONNECT:
return "CONNECT"sv;
break;
case cinatra::http_method::OPTIONS:
return "OPTIONS"sv;
break;
case cinatra::http_method::TRACE:
return "TRACE"sv;
break;
default:
return "UNKONWN"sv;
break;
}
}

constexpr auto type_to_name(std::integral_constant<http_method, http_method::DEL>) noexcept { return "DELETE"sv; }
constexpr auto type_to_name(std::integral_constant<http_method, http_method::GET>) noexcept { return "GET"sv; }
constexpr auto type_to_name(std::integral_constant<http_method, http_method::HEAD>) noexcept { return "HEAD"sv; }
Expand Down

0 comments on commit 6609b3b

Please sign in to comment.