Permalink
Browse files

Use `res.message` for sending batch file errors.

The messenger middleware provides this method.

Dav recently fixed a bug for Chrome by sending
a body for 404 errors. Since this method will also
send a body, the bug should remain fixed.
  • Loading branch information...
1 parent eefee4d commit 6deffcc78c5a9f2a0ed3b471c55f5e87484be636 @reid reid committed Jun 8, 2012
Showing with 3 additions and 10 deletions.
  1. +3 −10 lib/hub/batch.js
View
13 lib/hub/batch.js
@@ -181,22 +181,15 @@ Batch.prototype.handleFileRequest = function (server, filename) {
server.res.writeHead(302, {
"Location": agent.nextURL()
});
+ server.res.end();
} else {
batch.report("agentError", agent, {
message: "Unable to serve the file: " + filename + ", ignoring"
});
- server.res.writeHead(404, {
- "content-type": "text/plain"
- });
- server.res.end("Not Found");
+ server.res.message(404);
}
-
- server.res.end();
} else {
- server.res.writeHead(500, {
- "content-type": "text/plain"
- });
- server.res.end("Unable to serve this file.");
+ server.res.message(500);
}
return;
}

0 comments on commit 6deffcc

Please sign in to comment.