Skip to content

Commit

Permalink
Removed Content-Length for chunked
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Nov 5, 2010
1 parent 0526a24 commit e338e74
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
2 changes: 0 additions & 2 deletions lib/express/response.js
Expand Up @@ -166,10 +166,8 @@ http.ServerResponse.prototype.sendfile = function(path, fn){
+ end
+ '/'
+ stat.size);
self.header('Content-Length', end - start + 1);
} else {
var stream = fs.createReadStream(path);
self.header('Content-Length', stat.size);
}
self.contentType(path);
self.header('Accept-Ranges', 'bytes');
Expand Down
9 changes: 3 additions & 6 deletions test/response.test.js
Expand Up @@ -243,7 +243,7 @@ module.exports = {
{ body: 'Internal Server Error', status: 500 });
assert.response(app,
{ url: '/large.json' },
{ status: 200, headers: { 'Content-Length': 2535, 'Content-Type': 'application/json' }});
{ status: 200, headers: { 'Content-Type': 'application/json' }});
},

'test #sendfile() Accept-Ranges': function(assert){
Expand Down Expand Up @@ -277,7 +277,6 @@ module.exports = {
{ url: '/large.json', headers: { 'Range': 'bytes=0-499' }},
{ headers: {
'Content-Type': 'application/json',
'Content-Length': 500,
'Content-Range': 'bytes 0-499/2535'
}, status: 206 });
},
Expand All @@ -296,8 +295,7 @@ module.exports = {
assert.response(app,
{ url: '/large.json', headers: { 'Range': 'basdytes=asdf' }},
{ headers: {
'Content-Type': 'application/json',
'Content-Length': 2535
'Content-Type': 'application/json'
}, status: 200 });
},

Expand All @@ -315,8 +313,7 @@ module.exports = {
assert.response(app,
{ url: '/large.json', headers: { 'Range': 'bytes=500-10' }},
{ headers: {
'Content-Type': 'application/json',
'Content-Length': 2535
'Content-Type': 'application/json'
}, status: 200 });
},

Expand Down

0 comments on commit e338e74

Please sign in to comment.