diff --git a/server.js b/server.js index ee0ef34..03bd9ba 100755 --- a/server.js +++ b/server.js @@ -218,15 +218,7 @@ Server.prototype = new function () { ) ); - if (request.method != 'HEAD' && request.method != 'GET') { - // I don't know how to do this. - response.writeHead(405, { - 'allow': 'HEAD, GET' - , 'content-type': 'text/plain; charset=utf-8' - }); - response.write("405: Only the HEAD or GET methods are allowed."); - response.end(); - } else if (!modulePath) { + if (!modulePath) { if (next) { next(); } else { @@ -236,6 +228,14 @@ Server.prototype = new function () { response.write("404: The requested resource could not be found."); response.end(); } + } else if (request.method != 'HEAD' && request.method != 'GET') { + // I don't know how to do this. + response.writeHead(405, { + 'allow': 'HEAD, GET' + , 'content-type': 'text/plain; charset=utf-8' + }); + response.write("405: Only the HEAD or GET methods are allowed."); + response.end(); } else if (!('callback' in url.query)) { // I respond with a straight-forward proxy. var resourceURI = this._resourceURIForModulePath(modulePath);