Skip to content

feign-mock: optionally match request URLs without decoding them - #3685

Merged
velo merged 1 commit into
OpenFeign:masterfrom
kumarprabhashanand:mock-match-encoded-urls
Nov 16, 2026
Merged

velo merged 1 commit into
OpenFeign:masterfrom
kumarprabhashanand:mock-match-encoded-urls

Conversation

@kumarprabhashanand

Copy link
Copy Markdown
Contributor

Fixes #787

Existing:

  • MockClient decodes every request URL before matching, so a request sent to /files/a%2Fb matches /files/a/b, and a test can't check the URL the client actually sends.

Changes:

  • Adds opt-in MockClient#matchEncodedUrls(). Stubs and verifications then use the URL as sent, e.g. /files/a%2Fb.
  • The default is unchanged, because existing tests stub decoded URLs (MockClientTest stubs ?client_id=7 7).
  • The flag is on the client, not on RequestKey.
  • Document in mock/README.asciidoc.

Tests:

  • Verified using ./mvnw clean install -Dtoolchain.skip (JDK 25) on mock and every module that depends on it (except jdk-json, which needs JDK 28): no failures.

Question:

  • would you prefer to stop decoding URLs altogether, a breaking change that could go in 14.x? I would be happy to raise a separate follow-up PR.

Add MockClient#matchEncodedUrls() so stubs and verifications match the
URL the client actually sends, e.g. /files/a%2Fb rather than the decoded
/files/a/b. It is opt-in because existing tests stub decoded URLs, so
the default behavior is unchanged.

Fixes OpenFeign#787

Signed-off-by: Prabhash <8548359+kumarprabhashanand@users.noreply.github.com>
@velo
velo enabled auto-merge (squash) November 16, 2026 10:57

@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.

LGTM - optional URL matching without decoding in feign-mock is a useful additive feature.

@velo
velo merged commit ceff82c into OpenFeign:master Nov 16, 2026
3 checks passed
@kumarprabhashanand
kumarprabhashanand deleted the mock-match-encoded-urls branch November 16, 2026 22:07
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.

MockClient decode url before matching

2 participants