Skip to content

Commit

Permalink
Fix a non-response on error.
Browse files Browse the repository at this point in the history
If you attempted to POST to an unknown URL, the server would hang rather than
give an expected response. Now a 405 error is returned instead.
  • Loading branch information
mbostock committed May 14, 2012
1 parent 0d86328 commit 6447735
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/cube/server.js
Expand Up @@ -131,9 +131,9 @@ module.exports = function(options) {
// If this request wasn't matched, see if there's a static file to serve.
request.on("end", function() {
file.serve(request, response, function(error) {
if (error && error.status == 404) {
response.writeHead(404, {"Content-Type": "text/plain"});
response.end("404 Not Found");
if (error) {
response.writeHead(error.status, {"Content-Type": "text/plain"});
response.end(error.status + "");
}
});
});
Expand Down

0 comments on commit 6447735

Please sign in to comment.