Skip to content

Clarify how to send literal JSON request bodies - #3686

Merged
velo merged 1 commit into
OpenFeign:masterfrom
hutiefang76:frank/docs-feign2041-literal-json-20261113
Nov 16, 2026
Merged

velo merged 1 commit into
OpenFeign:masterfrom
hutiefang76:frank/docs-feign2041-literal-json-20261113

Conversation

@hutiefang76

Copy link
Copy Markdown
Contributor

The @Body Javadoc recommends URL-encoding literal braces without distinguishing static bodies from templates. For example, @Body("%7B%7D") sends those characters as-is instead of sending an empty JSON object.

Clarify the escaping advice and point users sending literal JSON to an unannotated String or byte[] parameter with the default encoder. The README explains the two annotation cases and links to the existing encoder example. Runtime behavior is unchanged.

Refs #2041.

Validation:

  • mvn -Pdev -pl core test: 872 cases, 0 failures/errors, 4 skipped, using JDK 25 and Java 8/25 toolchains.
  • mvn -Pdev validate: all reactor modules passed.
  • Core Javadoc generated with the existing release settings (doclint=none, legacyMode=true, maven.javadoc.disableNoFonts=true); unresolved-link warnings remain.
  • A Java 8-compiled probe exercised six cases over real loopback HTTP on JDK 8 and 25: raw String/byte[] JSON, braces and percent characters, the existing interpolated template, empty-brace rejection, and the verbatim static encoded body. The expectation that @Body("%7B%7D") sends {} failed as described above.

Prepared with AI assistance (DeepSeek and Codex).

Distinguish JSON body templates from literal request body parameters.
The brace-escaping advice does not decode a static annotation value.

Refs OpenFeign#2041

Assisted-by: DeepSeek
Assisted-by: Codex

@velo velo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good docs update - clarifies literal JSON request body usage.

@velo
velo enabled auto-merge (squash) November 16, 2026 10:57
@velo
velo merged commit 6f91045 into OpenFeign:master Nov 16, 2026
3 checks passed
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.

2 participants