Allow `MultiPartParser` to parse PATCH requests (#2062)
This commit is contained in:
parent
8bdb9b2fa6
commit
de5a4a5f57
|
@ -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())
|
||||||
|
|
Loading…
Reference in New Issue