From 6609b3b888fe49f4dc3faa1d4fe6479beb5bdcae Mon Sep 17 00:00:00 2001 From: Gogs Date: Tue, 27 Feb 2018 15:26:42 +0800 Subject: [PATCH] update --- utils.hpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) 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; }