Skip to content
Browse files

fixed a typo -- why do node http use two differnet properties (status…

… and statusCode) depending on which parts of the library youre dealing with?!
  • Loading branch information...
1 parent 27ee713 commit 3f34b13ea05efd93c2b93a4efbb822208ddfbc02 @rsms committed Apr 19, 2010
Showing with 10 additions and 4 deletions.
  1. +10 −4 oui/server/http-patches/response.js
View
14 oui/server/http-patches/response.js
@@ -50,6 +50,9 @@ mixin(http.ServerResponse.prototype, {
this.setHeader('Content-Length', len);
},
+ get statusCode() { return this.status; },
+ set statusCode(status) { this.status = status; },
+
prepare: function() {
var server = this.request.connection.server
this.headers = [
@@ -219,13 +222,16 @@ mixin(http.ServerResponse.prototype, {
},
// Send a standard response with optional HTTP status code.
- send: function(statusCode) {
- if (!statusCode) statusCode = this.statusCode || 200;
- else this.statusCode = statusCode;
+ send: function(statusCode, obj) {
+ if (!statusCode)
+ statusCode = this.status || 200;
+ else
+ this.status = statusCode;
if (http.BODYLESS_STATUS_CODES.indexOf(statusCode)) {
this.request.sendResponse();
} else {
- var obj = {status: http.STATUS_CODES[statusCode] || statusCode};
+ if (!obj)
+ obj = {status: http.STATUS_CODES[statusCode] || statusCode};
this.sendObject(obj);
}
},

0 comments on commit 3f34b13

Please sign in to comment.
Something went wrong with that request. Please try again.