Permalink
Browse files

Fix a non-response on error.

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...
1 parent 0d86328 commit 644773588f97d5bf7581ddb042892cc2ddd2a6f8 @mbostock mbostock committed May 14, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/cube/server.js
View
@@ -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 + "");
}
});
});

0 comments on commit 6447735

Please sign in to comment.