-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Description
Peter Luttrell opened SPR-15347 and commented
The PATCH
HTTP method (rfc5789) is gaining popularity. In fact, Spring Data Rest Repositories provides endpoints that use it by default on all entities.
The RestTemplate
, however, does not support PATCH
out of the box because the RestTemplate
relies on SimpleClientHttpRequestFactory
, which in turn relies on the JDKs HttpURLConnection
class, which doesn't currently support it.
This issue has been reported elsewhere and treated as a documentation issue because if you choose other ways of making the connections...including several hacks..it will work. Reference #19618, GitHub Spring-cloud/spring-cloud-netflix issue #1777, GitHub Spring-cloud/spring-cloud-netflix issue #1022 and StackOverflow: RestTemplate PATCH request.
But treating this as a documentation issue doesn't serve the best interest of Spring users. Sure instructions for how to enable it is buried in the javadocs for Spring... but this introduces an unnecessary barrier to successfully using the RestTemplate with Spring Data Rest Repositories...or any other service that uses PATCH
calls. This could cause unnecessary frustration in using the RestTemplate
.
With this ticket, I propose that the RestTemplate
be enhanced to support the PATCH
method by default without any custom configuration.
This might also have the added benefit of better test coverage with whatever implementation is chosen.
Affects: 4.3.7
Issue Links:
- Doc: Can't issue PATCH request using RestTemplate with SimpleClientHttpRequestFactory [SPR-15052] #19618 Doc: Can't issue PATCH request using RestTemplate with SimpleClientHttpRequestFactory