diff options
author | ipknHama <ipknhama@gmail.com> | 2017-10-21 21:20:07 +0900 |
---|---|---|
committer | ipknHama <ipknhama@gmail.com> | 2017-12-25 15:31:20 +0900 |
commit | daa1e3eadcfb99bde158a6a9d9455d113b005df5 (patch) | |
tree | d73be02abca55b5001c76e9a91b14e9385f5c90e /include/crow/common.h | |
parent | 6876a08e61a67592b53a823260203a5e9cd04618 (diff) | |
download | crow-daa1e3eadcfb99bde158a6a9d9455d113b005df5.tar.gz crow-daa1e3eadcfb99bde158a6a9d9455d113b005df5.zip |
Add PURGE method, add a special enum item for counting
Diffstat (limited to 'include/crow/common.h')
-rw-r--r-- | include/crow/common.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/include/crow/common.h b/include/crow/common.h index ac6e789..f38a3c7 100644 --- a/include/crow/common.h +++ b/include/crow/common.h @@ -19,7 +19,8 @@ namespace crow CONNECT, OPTIONS, TRACE, - PATCH = 24, + PATCH, + PURGE, #endif Delete = 0, @@ -30,7 +31,12 @@ namespace crow Connect, Options, Trace, - Patch = 24, + Patch, + Purge, + + + InternalMethodCount, + // should not add an item below this line: used for array count }; inline std::string method_name(HTTPMethod method) @@ -55,6 +61,10 @@ namespace crow return "TRACE"; case HTTPMethod::Patch: return "PATCH"; + case HTTPMethod::Purge: + return "PURGE"; + default: + return "invalid"; } return "invalid"; } @@ -137,6 +147,7 @@ constexpr crow::HTTPMethod operator "" _method(const char* str, size_t /*len*/) crow::black_magic::is_equ_p(str, "CONNECT", 7) ? crow::HTTPMethod::Connect : crow::black_magic::is_equ_p(str, "TRACE", 5) ? crow::HTTPMethod::Trace : crow::black_magic::is_equ_p(str, "PATCH", 5) ? crow::HTTPMethod::Patch : + crow::black_magic::is_equ_p(str, "PURGE", 5) ? crow::HTTPMethod::Purge : throw std::runtime_error("invalid http method"); } #endif |