Allow `MultiPartParser` to parse PATCH requests (#2062)

This commit is contained in:
Muhammad 2024-06-09 18:46:57 +03:00 committed by GitHub
parent 8bdb9b2fa6
commit de5a4a5f57
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 2 deletions

View File

@ -52,8 +52,16 @@ const SafeStringMap<std::string> &MultiPartParser::getParameters() const
int MultiPartParser::parse(const HttpRequestPtr &req) int MultiPartParser::parse(const HttpRequestPtr &req)
{ {
if (req->method() != Post && req->method() != Put) switch (req->method())
return -1; {
case Post:
case Put:
case Patch:
break;
default:
return -1;
}
const std::string &contentType = const std::string &contentType =
static_cast<HttpRequestImpl *>(req.get())->getHeaderBy("content-type"); static_cast<HttpRequestImpl *>(req.get())->getHeaderBy("content-type");
if (contentType.empty()) if (contentType.empty())