drogonframework / drogon

Drogon: A C++14/17/20 based HTTP web application framework running on Linux/macOS/Unix/Windows
MIT License
11.04k stars 1.06k forks source link

`MultiPartParser` always fails on PATCH requests #2061

Closed Mis1eader-dev closed 2 weeks ago

Mis1eader-dev commented 2 weeks ago

Describe the bug Using PUT it works fine, but PATCH refuses to parse the body.

To Reproduce Steps to reproduce the behavior:

  1. Create two API endpoints, one with PUT, one with PATCH.
  2. Parse the same Form Data from both.
  3. Observe the return status of MultiPartParser::parse on both.
  4. parser.parse(req) == -1 is true for PATCH, and false for PUT.

Expected behavior Should work for both HTTP methods.

Additional context The printed body by PUT:

--X-INSOMNIA-BOUNDARY
Content-Disposition: form-data; name="title"

Rozzlin
--X-INSOMNIA-BOUNDARY--

By PATCH:

--X-INSOMNIA-BOUNDARY
Content-Disposition: form-data; name="title"

Rozzlin
--X-INSOMNIA-BOUNDARY--

They are identical, and yet it fails on PATCH?