@@ -19,7 +19,7 @@ World":
1919var sys = require("sys"),
2020 http = require("http");
2121http.createServer(function (request, response) {
22- response.sendHeader (200, {"Content-Type": "text/plain"});
22+ response.writeHeader (200, {"Content-Type": "text/plain"});
2323 response.write("Hello World\n");
2424 response.close();
2525}).listen(8000);
@@ -916,16 +916,18 @@ The +http.Connection+ object.
916916This object is created internally by a HTTP server--not by the user. It is
917917passed as the second parameter to the +"request"+ event.
918918
919- +response.sendHeader (statusCode, headers)+ ::
919+ +response.writeHeader (statusCode[, reasonPhrase] , headers)+ ::
920920
921921Sends a response header to the request. The status code is a 3-digit HTTP
922- status code, like +404+. The second argument, +headers+, are the response headers.
922+ status code, like +404+. The last argument, +headers+, are the response headers.
923+ Optionally one can give a human-readable +reasonPhrase+ as the second
924+ argument.
923925+
924926Example:
925927+
926928----------------------------------------
927929var body = "hello world";
928- response.sendHeader (200, {
930+ response.writeHeader (200, {
929931 "Content-Length": body.length,
930932 "Content-Type": "text/plain"
931933});
@@ -936,7 +938,7 @@ be called before +response.close()+ is called.
936938
937939+response.write(chunk, encoding="ascii")+ ::
938940
939- This method must be called after +sendHeader + was
941+ This method must be called after +writeHeader + was
940942called. It sends a chunk of the response body. This method may
941943be called multiple times to provide successive parts of the body.
942944+
@@ -1260,7 +1262,7 @@ http.createServer(function (req, res) {
12601262 fields = {},
12611263 name, filename;
12621264 mp.addListener("error", function (er) {
1263- res.sendHeader (400, {"content-type":"text/plain"});
1265+ res.writeHeader (400, {"content-type":"text/plain"});
12641266 res.write("You sent a bad message!\n"+er.message);
12651267 res.close();
12661268 });
@@ -1280,7 +1282,7 @@ http.createServer(function (req, res) {
12801282 });
12811283 mp.addListener("complete", function () {
12821284 var response = "You posted: \n" + sys.inspect(fields);
1283- res.sendHeader (200, {
1285+ res.writeHeader (200, {
12841286 "content-type" : "text/plain",
12851287 "content-length" : response.length
12861288 });
0 commit comments