Repository navigation
fix: Prevent an aborted query from creating an empty object - #10820
beiguancyc wants to merge 1 commit into
Conversation
A query sent as POST with _method GET is routed as a create when the connection closes before the body is parsed, which saves an empty object. Closes parse-community#10815 Co-authored-by: Cursor <cursoragent@cursor.com>
|
I will reformat the title to use the proper commit message syntax. |
|
🚀 Thanks for opening this pull request! We appreciate your effort in improving the project. Please let us know once your pull request is ready for review. Tip
Note Please respond to review comments from AI agents just like you would to comments from a human reviewer. Let the reviewer resolve their own comments, unless they have reviewed and accepted your commit, or agreed with your explanation for why the feedback was incorrect. Caution Pull requests must be written using an AI agent with human supervision. Pull requests written entirely by a human will likely be rejected, because of lower code quality, higher review effort and the higher risk of introducing bugs. Please note that AI review comments on this pull request alone do not satisfy this requirement. Our CI and AI review are safeguards, not development tools. If many issues are flagged, rethink your development approach. Invest more effort in planning and design rather than using review cycles to fix low-quality code. |
Issue
#10815
A query sent as
POSTwith_method: "GET"is executed as a create and saves an empty object when the client closes the connection while an async middleware beforeexpress.json()is still pending.body-parsertreats the closed socket as already finished, skips the body, andreq.bodystaysundefined.allowMethodOverridethen keeps the method asPOST, andhandleCreatesavesreq.body || {}.Approach
Reject the request when it declares a body (
Content-Length > 0orTransfer-Encoding) but the body was not parsed. Multipart requests are excluded, because the JSON parser intentionally skips them. The request fails withParse.Error.INVALID_JSONbefore it can be routed as a create.Tasks
Made with Cursor
Summary by CodeRabbit