Skip to content

Proposal: http: automaticly send Content-Length header when possible #1044

Closed
@tellnes

Description

@tellnes

I propose we make http set the Content-Length header when the user does only call OutgoingMessage.prototype.end and not write or writeHead.

Eg.

require('http').createServer(function (req, res) {
  res.end('Hello World')
}).listen(1337)
HTTP/1.1 200 OK
Date: Tue, 03 Mar 2015 19:42:18 GMT
Connection: keep-alive
Content-Length: 11

Hello World

It is a trivial change in lib/, but breaks a lot of tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    httpIssues or PRs related to the http subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions