In the latest 5.0.0 snapshots, RestTemplate has started dropping a trailing / when the URI is passed in as a String. For example, a request to http://localhost:8080/spring/ will become a request to http://localhost:8080/spring.
The loss of the / happens during variable expansion so I think that this commit may have introduced the problem. A workaround is to pass a URI into RestTemplate rather than a String so that expansion does not occur.
Affects: 5.0 M5
Issue Links:
#19691 Provide convenient ways to specify query parameters to WebClient
Indeed this is related to the commit introducing UriBuilderFactory along with the commit deprecating the DefaultUriTemplateHandler and the change in the default from not parsing to parsing the path of the URI template into path segments.
I have fixed the issue and also added a property to the new DefaultUriBuilderFactory which is the replacement for DefaultUriTemplateHandler but I am hoping we can keep the same defaults across the RestTemplate and the WebClient and I think the should be possible.
Andy Wilkinson opened SPR-15201 and commented
In the latest 5.0.0 snapshots,
RestTemplate
has started dropping a trailing/
when the URI is passed in as aString
. For example, a request tohttp://localhost:8080/spring/
will become a request tohttp://localhost:8080/spring
.The loss of the
/
happens during variable expansion so I think that this commit may have introduced the problem. A workaround is to pass aURI
intoRestTemplate
rather than aString
so that expansion does not occur.Affects: 5.0 M5
Issue Links:
Referenced from: commits b487ed6
The text was updated successfully, but these errors were encountered: