Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated router to use .writeHead() instead of .sendHeader().

  • Loading branch information...
commit a0b826b8193ac83b3a6d6c9bf7f1aa22cafae1ed 1 parent f90b9d6
@scottgonzalez scottgonzalez authored
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/router/index.js
View
8 lib/router/index.js
@@ -8,7 +8,7 @@ var router = exports;
var NOT_FOUND = "Not Found\n";
function notFound(req, res) {
- res.sendHeader(404, [
+ res.writeHead(404, [
["Content-Type", "text/plain"],
["Content-Length", NOT_FOUND.length]
]);
@@ -24,7 +24,7 @@ router.createServer = function() {
var handler = getMap[url.parse(req.url).pathname] || notFound;
res.simpleText = function (code, body) {
- res.sendHeader(code, [ ["Content-Type", "text/plain"]
+ res.writeHead(code, [ ["Content-Type", "text/plain"]
, ["Content-Length", body.length]
]);
res.write(body);
@@ -33,7 +33,7 @@ router.createServer = function() {
res.simpleJSON = function (code, obj) {
var body = JSON.stringify(obj);
- res.sendHeader(code, [ ["Content-Type", "text/json"]
+ res.writeHead(code, [ ["Content-Type", "text/json"]
, ["Content-Length", body.length]
]);
res.write(body);
@@ -90,7 +90,7 @@ router.staticHandler = function (filename) {
return function (req, res) {
loadResponseData(function () {
- res.sendHeader(200, headers);
+ res.writeHead(200, headers);
res.write(body, encoding);
res.end();
});
Please sign in to comment.
Something went wrong with that request. Please try again.