Skip to content

Commit

Permalink
Merge pull request ipkn#383 from beached/patch-1
Browse files Browse the repository at this point in the history
Split up operator""_method
  • Loading branch information
The-EDev authored Apr 4, 2022
2 parents 1002ded + dcbb8a1 commit 71c01a9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion include/crow/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ namespace crow

// clang-format off
#ifndef CROW_MSVC_WORKAROUND
constexpr crow::HTTPMethod operator"" _method(const char* str, size_t /*len*/)
constexpr crow::HTTPMethod method_from_string(const char* str)
{
return crow::black_magic::is_equ_p(str, "GET", 3) ? crow::HTTPMethod::Get :
crow::black_magic::is_equ_p(str, "DELETE", 6) ? crow::HTTPMethod::Delete :
Expand Down Expand Up @@ -324,5 +324,10 @@ constexpr crow::HTTPMethod operator"" _method(const char* str, size_t /*len*/)
crow::black_magic::is_equ_p(str, "SOURCE", 6) ? crow::HTTPMethod::Source :
throw std::runtime_error("invalid http method");
}

constexpr crow::HTTPMethod operator""_method(const char* str, size_t /*len*/)
{
return method_from_string( str );
}
#endif
// clang-format on

0 comments on commit 71c01a9

Please sign in to comment.