Skip to content

Commit

Permalink
Incorrect statusCode was returned when using range headers
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceK33z committed Sep 15, 2016
1 parent d9cb811 commit cedc09f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ module.exports = function(compiler, options) {
if(-1 == ranges) {
res.setHeader('Content-Range', 'bytes */' + content.length);
res.statusCode = 416;
return content;
}

// valid (syntactically invalid/multiple ranges are treated as a regular response)
Expand Down Expand Up @@ -241,7 +240,8 @@ module.exports = function(compiler, options) {
res.setHeader(name, options.headers[name]);
}
}
res.statusCode = 200;
// Express automatically sets the statusCode to 200, but not all servers do (Koa).
res.statusCode = res.statusCode || 200;
if(res.send) res.send(content);
else res.end(content);
}
Expand Down

0 comments on commit cedc09f

Please sign in to comment.