Skip to content

HTTP responses with no mime type (content-type) and/or body (content-length) is not possible #54

@bbotsch-mpengs

Description

@bbotsch-mpengs

As far as I can tell, it is not possible to send an HTTP response with no mime type or body. You are forced to pick a mime type even if the body is empty and you are forced to send a content-length even if the length is 0. This is sometimes weird when you are forced to pick a mime type for an empty body when sending a 302 redirect for example. Other times it is wrong according to the spec.

Cases (non-exhaustive) where content-length MUST NOT be sent:

There are places in the codebase where the mime type is set to HTML or TEXT with an empty body for things like "Not Found", "Not Modified", "Method Not Allowed", and "Internal Server Error". While this is mostly harmless, it's just not necessary and so it feels weird.

Metadata

Metadata

Assignees

No one assigned

    Labels

    http/serverRelating to the HTTP server

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions