-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Closed
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)status: supersededAn issue that has been superseded by anotherAn issue that has been superseded by anothertype: enhancementA general enhancementA general enhancement
Description
Ryon Day opened SPR-17551 and commented
The RestTemplateBuilder
documentation for the rootUri()
method states:
"Set a root URL that should be applied to each request that starts with '/'."
However, the following code does not result in RestTemplate
expanding the URI:
UriTemplate template = new UriTemplate("/foo?bar={bar}");
this.restTemplate = restTemplateBuilder
.rootUri(URI.create("http://foo.bar"))
.build();
URI uri = template.expand("baz");
RequestEntity<Void> req = RequestEntity.get(uri)
.accept(MediaType.APPLICATION_JSON)
.header(accountLinkHeader, accountLinksHeader)
.build();
String response = restTemplate.exchange(req, String.class);
Moreover, the exception received is EXTREMELY ambiguous when this doesn't work. In fact, the Spring exception thrown occludes the initial Apache exception (which states there's no host).
Affects: 5.1.3
Metadata
Metadata
Assignees
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)status: supersededAn issue that has been superseded by anotherAn issue that has been superseded by anothertype: enhancementA general enhancementA general enhancement