From 71a04149b5bc0b950476d180924e57ce4781e34f Mon Sep 17 00:00:00 2001 From: qujian Date: Thu, 18 Jan 2018 03:05:33 +0800 Subject: [PATCH] fix code & type inverted --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 0588e7a..4f602c5 100644 --- a/index.js +++ b/index.js @@ -40,7 +40,7 @@ module.exports = function(port) { error = callback; }; - http.ServerResponse.prototype.send = function(message, code, type) { + http.ServerResponse.prototype.send = function(message, type, code) { code = code || 200; type = type || 'text/html'; if (typeof message === 'object') { @@ -67,7 +67,7 @@ module.exports = function(port) { } this.send(message, 'application/json', code); }; - + server.on('request', function(request, response) { var pathname = parse(request.url).pathname; if (typeof routes[request.method] === 'object') {