Skip to content
Browse files

adding method `status` for response

  • Loading branch information...
1 parent b156507 commit f26b0c4eb7623e56593c8d7b56cf6e8e9a47c86f @mvrilo committed Dec 11, 2011
Showing with 6 additions and 0 deletions.
  1. +2 −0 lib/frank.js
  2. +4 −0 lib/response.js
View
2 lib/frank.js
@@ -73,6 +73,7 @@ frank.server = function() {
path = handler.path,
method = handler.method,
middleware = handler.middleware,
+ status = handler.statusCode,
body = handler.body,
contentType = handler.contentType,
callback = handler.callback;
@@ -91,6 +92,7 @@ frank.server = function() {
if (req.method == method) {
res.setHeader('Content-Type', contentType);
res.setHeader('Content-Length', body.length);
+ if (status) res.statusCode = status;
res.end(body);
}
});
View
4 lib/response.js
@@ -1,6 +1,10 @@
var cons = require('consolidate').render;
module.exports = {
+ status : function(n) {
+ this.handler[this.route].statusCode = n;
+ return this;
+ },
send : function(str, type) {
type = type || 'text/plain';
this.handler[this.route].contentType = type;

0 comments on commit f26b0c4

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