Skip to content

res.sendStatus(205) returns a Reset Content body #4592

@tkesgar

Description

@tkesgar

It seems that HTTP 204 and 205 responses should not have a response body:

res.sendStatus(204) correctly returns no response body, but res.sendStatus(205) returns a Reset Content string. Is this expected?

How to reproduce

require('express')()
  .get('/204', (req, res) => res.sendStatus(204))
  .get('/205', (req, res) => res.sendStatus(205))
  .listen(8080, () => console.log('Ready'))
$ curl http://localhost:8080/204

$ curl http://localhost:8080/205
Reset Content

$ curl -I -XGET http://192.168.100.232:8080/204
HTTP/1.1 204 No Content
X-Powered-By: Express
ETag: W/"a-bAsFyilMr4Ra1hIU5PyoyFRunpI"
Date: Sun, 16 May 2021 12:26:18 GMT
Connection: keep-alive
Keep-Alive: timeout=5

$ curl -I -XGET http://192.168.100.232:8080/205
HTTP/1.1 205 Reset Content
X-Powered-By: Express
Content-Type: text/plain; charset=utf-8
Content-Length: 13
ETag: W/"d-yL62EER5Ke7tFugRpssh46aJ7As"
Date: Sun, 16 May 2021 12:26:25 GMT
Connection: keep-alive
Keep-Alive: timeout=5

Express version: 4.17.1
Node.js version: 15.14.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions