From de5a4a5f5705690358f55527a226a0fd1ec9855b Mon Sep 17 00:00:00 2001 From: Muhammad <73486659+Mis1eader-dev@users.noreply.github.com> Date: Sun, 9 Jun 2024 18:46:57 +0300 Subject: [PATCH] Allow `MultiPartParser` to parse PATCH requests (#2062) --- lib/src/MultiPart.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/src/MultiPart.cc b/lib/src/MultiPart.cc index fc6848cf..72f42805 100644 --- a/lib/src/MultiPart.cc +++ b/lib/src/MultiPart.cc @@ -52,8 +52,16 @@ const SafeStringMap &MultiPartParser::getParameters() const int MultiPartParser::parse(const HttpRequestPtr &req) { - if (req->method() != Post && req->method() != Put) - return -1; + switch (req->method()) + { + case Post: + case Put: + case Patch: + break; + default: + return -1; + } + const std::string &contentType = static_cast(req.get())->getHeaderBy("content-type"); if (contentType.empty())