Skip to content

Fix URI fragment replacement and preserve target escapes - #3633

Open
hutiefang76 wants to merge 1 commit into
OpenFeign:masterfrom
hutiefang76:frank/thirty-feign-next-20261019
Open

hutiefang76 wants to merge 1 commit into
OpenFeign:masterfrom
hutiefang76:frank/thirty-feign-next-20261019

Conversation

@hutiefang76

Copy link
Copy Markdown
Contributor

Fixes #3095.

Replacing /old#stale with /new?q=v retained #stale, with no API to clear it completely. A target such as https://example.com/a#encoded%20value%2F also lost its percent escapes because the decoded fragment was appended to the URL.

This clears the old fragment on URI replacement and preserves raw target fragments. Append behavior, explicit empty fragments, copying, and normal template resolution retain their existing behavior. The internal resolve path carries the separately stored fragment forward. No public setter or dependency is added.

Nine tests cover both failures and those controls; the changelog records the replacement semantics for 13.18.

Validation on macOS ARM64, using a fixed JDK 8 toolchain for main sources and an actual Temurin JDK 25.0.4.1 toolchain for test compilation/execution:

  • Original code plus the regressions: 58 RequestTemplate tests, 3 failures, 0 errors/skips.
  • ./mvnw -Pdev -pl core clean verify: 781 tests, 0 failures/errors, 4 existing conditional skips. All 58 RequestTemplate tests pass.
  • Root ./mvnw -Pdev validate: passes with the required JDK 8/11/25 toolchains.

Checks ran in an independent checkout of the same base because the license plugin's JGit failed on a Git worktree. License and formatter checks remained enabled; all three tested file hashes match the submitted files. Local toolchain configuration is not part of the patch.

AI assistance: DeepSeek assisted implementation and first-pass review; Codex coordinated reproduction, actual validation, and final diff review.

A replacement URI should not retain a fragment from the previous URI.
Keep the fragment during template resolution and preserve percent escapes
in target fragments so they remain valid URL text.

Fixes OpenFeign#3095
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.

How to clear fragment of RequestTemplate (Feign client 11.10)?

1 participant