Skip to content

fix(runtime): forward a bare body on PATCH/PUT like POST#3

Merged
Tam2 merged 1 commit into
mainfrom
fix/patch-put-bare-body-fallback
Jul 15, 2026
Merged

fix(runtime): forward a bare body on PATCH/PUT like POST#3
Tam2 merged 1 commit into
mainfrom
fix/patch-put-bare-body-fallback

Conversation

@Tam2

@Tam2 Tam2 commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Problem

A no-path endpoint's generated command wrapper passes the request body directly (there is no path/body key), e.g. patchUsersCommand({ firstName, lastName }). But handlePatchCommand/handlePutCommand only forwarded input.body:

...(hasBody && { body: input.body }),

Since a bare body has no body key, hasBody is false and the body was silently dropped — an empty PATCH/PUT was sent. handlePostCommand already handled this correctly via a fallback (body: hasBody ? input.body : input), which is why POST worked but PATCH/PUT didn't on the same no-path shape.

Real-world impact: a profile-update form calling patchUsersCommand({ firstName, lastName }) sent an empty request; the fields never reached the server.

Fix

Make handlePatchCommand and handlePutCommand use the same bare-body fallback as handlePostCommand:

body: hasBody ? input.body : input,
  • { path, body } and { body } shapes are unchanged (hasBody true → input.body).
  • A bare body ({ ...fields }) is now forwarded as the request body.

Tests

Added regression tests for both handlePatchCommand and handlePutCommand covering the bare-body (no path/body key) shape. Full suite: 93 passing.

Bumps version to 0.1.7 so the publish workflow ships it.

A no-path endpoint's generated wrapper passes the request body directly (no `body`
key). handlePatchCommand/handlePutCommand only forwarded input.body, so the bare
body was silently dropped and an empty PATCH/PUT was sent. Match handlePostCommand's
fallback (body: hasBody ? input.body : input). Adds regression tests. Bumps to 0.1.7.
@Tam2 Tam2 merged commit cb02220 into main Jul 15, 2026
3 checks passed
@Tam2 Tam2 deleted the fix/patch-put-bare-body-fallback branch July 15, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant