Repository navigation
Encode instance ids in RestClient getInstance requests - #4614
Merged
ryanjbaxter merged 1 commit intoOct 7, 2026
Merged
Conversation
RestClientEurekaHttpClient built the getInstance URLs by string concatenation, so an instance id containing '#' or '?' was cut at that character and the request asked for a different instance. Build the path with pathSegment, as the WebClient transport already does. The shared test passed such an id but never checked what the server received; the mock now echoes the requested id back. Signed-off-by: kdelay <kdelay20@gmail.com>
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.
RestClientEurekaHttpClient.getInstanceconcatenates the instance id into the path, so it is parsed as a URI template and an id containing#or?is cut at that character. #4291 fixed this for the RestTemplate and WebClient transports (gh-4121), but the RestClient transport, now the default in 5.0, still builds the path as a string.This uses
pathSegment, asWebClientEurekaHttpClientdoes.testGetInstancealready passedtest#1.[3.?]!but never checked what the server received. The mock now returns the requested id and the test asserts it. Without the fix:./mvnw -pl spring-cloud-netflix-eureka-client -am verifypasses.