Skip to content

RestTemplate should support Void response types [SPR-8572] #13216

@spring-projects-issues

Description

@spring-projects-issues

Brad Cupit opened SPR-8572 and commented

when calling RestTemplate.exchange() I should be able to use a Void response type. Example (notice the last parameter):

restTemplate.exchange(webServiceUrl, HttpMethod.DELETE, null, Void.class);

The Void class implies no return entity and reads a little better than null for the response type.

The fix should be trivial. In RestTemplate.ResponseEntityResponseExtractor's constructor, just change this line:
if (responseType != null)
to this:
if (responseType != null && responseType != Void.class)


Affects: 3.0.5

Referenced from: commits c472a16

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions