Skip to content

Enhance RestTemplate to support PATCH out of the box [SPR-15347] #19910

@spring-projects-issues

Description

@spring-projects-issues

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:

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: declinedA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions