Skip to content

Responses with 204 HTTP status code (aka "no content") actually have "Content-Type" header set. #184

@neomerx

Description

@neomerx

This is actually somewhere in between bug and not but closer to annoying 'feature' IMHO

RFC 7231 says

A sender that generates a message containing a payload body SHOULD
generate a Content-Type header field in that message unless the
intended media type of the enclosed representation is unknown to the
sender.

In other words, it recommends adding the header if Response has a body. If you think it's a server's obligation read the following

If a Content-Type header field is not present, the recipient
MAY either assume a media type of "application/octet-stream"
([RFC2046], Section 4.5.1) or examine the data to determine its type.

The RFC says nothing if the header may be omitted for bodyless responses. However, as it allows omit it reardless it would be reasonable to keep it only for requests with a body.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions