Repository navigation
fix: allow bodyless non-GET requests in api request rest - #270
Merged
soridalac merged 1 commit intoNov 30, 2026
Merged
Conversation
A DELETE (or any non-GET request) with no --body and no --file threw "No 'mode' found in 'body' entry" before sending, and so did the documented empty body --body "". Only read the body from --file when the file has one; otherwise send no body. Fixes forcedotcom/cli#3693 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 task done
soridalac
approved these changes
Nov 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes forcedotcom/cli#3693
What
sf api request rest -X DELETE <url>(or any non-GET request) with no--bodyand no--filethrewNo 'mode' found in 'body' entryand never sent the request. The documented empty body,--body "", failed the same way.This happened because the last branch of the body logic always called
getBodyContents(fileOptions?.body). That runs even when there's no--file, and when--bodyis"", which is falsy.Change
--filewhen--bodyisn't given and the file has abody.--filebody that's present but has nomodestill raises the existing error.Tests
--body/--file, and a DELETE with--body "". Both expect a bodyless request.mainwith the reported error and pass with this change.yarn build,yarn lintandyarn test:onlypass (22 passing).🤖 Generated with Claude Code