diff --git a/examples/simple_example/DigestAuthFilter.cc b/examples/simple_example/DigestAuthFilter.cc index ea08fc57..212b6191 100644 --- a/examples/simple_example/DigestAuthFilter.cc +++ b/examples/simple_example/DigestAuthFilter.cc @@ -21,6 +21,8 @@ std::string method2String(HttpMethod m) return "DELETE"; case Options: return "OPTIONS"; + case Patch: + return "PATCH"; default: return "INVALID"; } diff --git a/examples/simple_example/main.cc b/examples/simple_example/main.cc index dbb9ef93..844132fb 100644 --- a/examples/simple_example/main.cc +++ b/examples/simple_example/main.cc @@ -334,6 +334,9 @@ int main() case Head: std::cout << " (Head) "; break; + case Patch: + std::cout << " (PATCH) "; + break; default: break; } diff --git a/lib/inc/drogon/HttpTypes.h b/lib/inc/drogon/HttpTypes.h index 9ad31877..9d1bded3 100644 --- a/lib/inc/drogon/HttpTypes.h +++ b/lib/inc/drogon/HttpTypes.h @@ -118,6 +118,7 @@ enum HttpMethod Put, Delete, Options, + Patch, Invalid }; diff --git a/lib/src/ConfigLoader.cc b/lib/src/ConfigLoader.cc index 84d331d2..e47dc094 100644 --- a/lib/src/ConfigLoader.cc +++ b/lib/src/ConfigLoader.cc @@ -202,6 +202,10 @@ static void loadControllers(const Json::Value &controllers) { constraints.push_back(Delete); } + else if (strMethod == "patch") + { + constraints.push_back(Patch); + } } } if (!controller["filters"].isNull()) diff --git a/lib/src/HttpRequestImpl.cc b/lib/src/HttpRequestImpl.cc index c845a69b..1113c41b 100644 --- a/lib/src/HttpRequestImpl.cc +++ b/lib/src/HttpRequestImpl.cc @@ -536,6 +536,9 @@ const char *HttpRequestImpl::methodString() const case Options: result = "OPTIONS"; break; + case Patch: + result = "PATCH"; + break; default: break; } @@ -576,6 +579,16 @@ bool HttpRequestImpl::setMethod(const char *start, const char *end) method_ = Invalid; } break; + case 5: + if (m == "PATCH") + { + method_ = Patch; + } + else + { + method_ = Invalid; + } + break; case 6: if (m == "DELETE") {