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

UnsupportedOperationException when using RestOperations + UriTemplate via RequestEntity #1062

Open
i8r opened this issue Mar 15, 2021 · 0 comments
Assignees
Labels

Comments

@i8r
Copy link

i8r commented Mar 15, 2021

I get a UnsupportedOperationException when I use the RestOperations#exchange for the RestOperations provided by riptide in combination with a uri template that created via the request entity builders.

Expected Behavior

RestOperations#exchangeshould honor the uri template.

Actual Behavior

java.lang.UnsupportedOperationException: null
	at org.springframework.http.RequestEntity.getUrl(RequestEntity.java:165) ~[spring-web-5.3.4.jar:5.3.4]
	at org.zalando.riptide.compatibility.HttpOperations.exchange(HttpOperations.java:304) ~[riptide-compatibility-3.0.0-RC.16.jar:na]
	at org.zalando.riptide.compatibility.HttpOperations.exchange(HttpOperations.java:294) ~[riptide-compatibility-3.0.0-RC.16.jar:na]

Possible Fix

Check for subtype UriTemplateRequestEntity before calling RequestEntity#getUrl()?

Steps to Reproduce

@Autowired
private RestOperations rest;

// …

        RequestEntity<EventTypeSpec> requestEntity = RequestEntity.put("/event-types/{}", eventTypeSpec.getName()).body(eventTypeSpec);
        rest.exchange(requestEntity, Map.class);

Your Environment

  • spring-web: 5.3.4
  • riptide: 3.0.0-RC.16
@i8r i8r added the Bug label Mar 15, 2021
@whiskeysierra whiskeysierra self-assigned this May 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants