Skip to content

createResponse method on HttpResponseMessage inconvenient when no body required #41

@JonathanGiles

Description

@JonathanGiles

The HttpRequestMessage class has a createResponse(status, body) method to return a response. This seems unfortunate when no body is required, but a header is, for example in the case of a redirect.

It would possibly be useful to have a createResponse(status) or createResponse() overloaded method, such that it is not necessary to write code such as the following (where url is duplicated or set to null - it is unclear what best practice is):

HttpResponseMessage response = request.createResponse(status, url);
response.addHeader("Location", url);
return response;

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions