diff --git a/utils.hpp b/utils.hpp index a97ed16a..f02a562f 100644 --- a/utils.hpp +++ b/utils.hpp @@ -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) noexcept { return "DELETE"sv; } constexpr auto type_to_name(std::integral_constant) noexcept { return "GET"sv; } constexpr auto type_to_name(std::integral_constant) noexcept { return "HEAD"sv; }