Parse request bodies for PUT/PATCH/DELETE in local dev web action params#165
Parse request bodies for PUT/PATCH/DELETE in local dev web action params#165
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Agent-Logs-Url: https://github.com/adobe/aio-cli-plugin-app-dev/sessions/947fbd2a-5e93-4c14-91a0-65ff85d22a09 Co-authored-by: shazron <36107+shazron@users.noreply.github.com>
There was a problem hiding this comment.
🤖 PR Reviewer
The change extends body processing to include PUT, PATCH, and DELETE HTTP methods alongside POST, which is a correct and standards-compliant improvement. The implementation is clean and the tests adequately cover the new method cases. One minor note: DELETE with a body is technically allowed but uncommon; the current approach is still reasonable.
✅ LGTM! This PR looks good to merge.
💡 How to re-trigger
Comment /review or /pr-reviewer on this PR
Agent-Logs-Url: https://github.com/adobe/aio-cli-plugin-app-dev/sessions/43165f12-7307-4f74-a8ff-c5760db64dfa Co-authored-by: shazron <36107+shazron@users.noreply.github.com>
There was a problem hiding this comment.
🤖 PR Reviewer
The change correctly expands HTTP method support for request body processing beyond POST to include PUT, PATCH, and DELETE, with appropriate use of optional chaining and case normalization. The tests cover the new methods well, though POST is notably absent from the methodsWithBody array used in parameterized tests (it's covered by existing dedicated tests). Overall the code is clean and the logic is sound.
✅ LGTM! This PR looks good to merge.
💡 How to re-trigger
Comment /review or /pr-reviewer on this PR
Fixes #164
Local
aio app devbehavior diverged from Adobe I/O Runtime by only parsing request bodies forPOST. As a result,PUT,PATCH, andDELETErequests with bodies were not merged into action params (or encoded as__ow_bodyfor raw actions).Body parsing parity across HTTP methods
createActionParametersFromRequestto process request bodies forpost,put,patch, anddeleteinstead ofpostonly.__ow_bodyusing existing logicRegression coverage for affected methods
PUT,PATCH, andDELETEincreateActionParametersFromRequest:application/json→ body fields merged into paramsapplication/json→ body encoded into__ow_bodyManual Testing
1. Check out the branch
git clone https://github.com/adobe/aio-cli-plugin-app-dev.git cd aio-cli-plugin-app-dev git checkout copilot/fix-request-body-parsing npm install2. Link the plugin locally via the Adobe I/O CLI
From the root of the checked-out branch, run:
aio plugins link .3. Create a test web action
In a new (or existing)
aioapp project, add a web action that echoes its params:Declare it as a web action in
app.config.yaml(e.g.web: 'yes').4. Start the local dev server
5. Verify body parsing for PUT, PATCH, and DELETE
Replace
<your-action-url>with the URL printed byaio app dev(e.g.https://localhost:9080/api/v1/web/<namespace>/<package>/echo).Expected: Each response should include
"myField"with the value you sent (e.g."hello from PUT").Before this fix:
params.myFieldwould beundefinedfor all three methods.