Skip to content
Myr

Stripping Content-Length / Content-Type when 204

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent ecbc3ca · Browse files · 2 files+10 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+10 added−1 removed

  • tests:+4 added−1 removed
  • other:+6 added−0 removed

2 files+10 added−1 removed

modified:lib/express/response.js+6 added
100 unmodified lines
101 this.header(field, headers[field]);102 }103 }104105 // Strip irrelevant headers106 if (204 === status) {107 delete this.headers['Content-Type'];108 delete this.headers['Content-Length'];109 }110111 // Respond112 this.writeHead(status, this.headers);113 this.end(body);114};
172 unmodified lines
modified:test/response.test.js+4 added-1 removed
59 unmodified lines
60 { url: '/buffer' },61 { body: 'wahoo!', headers: { 'Content-Type': 'application/octet-stream' }});62 assert.response(app,63 { url: '/noargs' },64 { status: 204 });64 { status: 204 }, function(res){65 assert.equal(undefined, res.headers['content-type']);66 assert.equal(undefined, res.headers['content-length']);67 });68 },69 70 'test #contentType()': function(assert){71 var app = express.createServer();
170 unmodified lines