Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TestRestTemplate exchange triggers UnsupportedOperationException when using a UriTemplateRequestEntity #25097

Closed
chrylis opened this issue Feb 3, 2021 · 1 comment
Assignees
Labels
type: regression A regression from a previous release
Milestone

Comments

@chrylis
Copy link
Contributor

chrylis commented Feb 3, 2021

In Boot 2.4.2, both overloads of TestRestTemplate#exchange that accept RequestEntity call getUrl on it. When the RequestEntity has been initialized with a URI template instead of a java.net.URI, this triggers an UnsupportedOperationException.

var req = RequestEntity.get("http://localhost/helloworld").build();
var resp = testRestTemplate.exchange(req, String.class);

Internally, the real RestTemplate dispatches based on the concrete type of RequestEntity, but TestRestTemplate fails to check.

see spring-projects/spring-framework#26500

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 3, 2021
@wilkinsona wilkinsona added type: regression A regression from a previous release and removed status: waiting-for-triage An issue we've not yet triaged labels Feb 4, 2021
@wilkinsona wilkinsona added this to the 2.4.x milestone Feb 4, 2021
@wilkinsona
Copy link
Member

It looks like we must be missing some tests. I think this change in behaviour is due to this change that was made in Framework 5.3.0.M1.

@wilkinsona wilkinsona self-assigned this Feb 4, 2021
@wilkinsona wilkinsona modified the milestones: 2.4.x, 2.4.3 Feb 4, 2021
@wilkinsona wilkinsona changed the title TestRestTemplate exchange triggers UnsupportedOperationException in RequestEntity TestRestTemplate exchange triggers UnsupportedOperationException when using a UriTemplateRequestEntity Feb 4, 2021
This was referenced Mar 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: regression A regression from a previous release
Projects
None yet
Development

No branches or pull requests

3 participants