From a5365f254748b37eaa1f646a47112dd57d29047c Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Sun, 29 Jan 2012 12:57:49 -0800 Subject: [PATCH] Support GET and HEAD. --- node/server.js | 2 +- node/utils/Minify.js | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/node/server.js b/node/server.js index a6a57497a..e25127f49 100644 --- a/node/server.js +++ b/node/server.js @@ -155,7 +155,7 @@ async.waterfall([ }); //serve minified files - app.get('/minified/:filename', minify.minifyJS); + app.all('/minified/:filename', minify.minifyJS); //checks for padAccess function hasPadAccess(req, res, callback) diff --git a/node/utils/Minify.js b/node/utils/Minify.js index 93bb263f8..23d3d8799 100644 --- a/node/utils/Minify.js +++ b/node/utils/Minify.js @@ -85,10 +85,18 @@ function _handle(req, res, jsFilename, jsFiles) { res.writeHead(304, {}); res.end(); } else { - if (settings.minify) { - respondMinified(); + if (req.method == 'HEAD') { + res.writeHead(200, {}); + res.end(); + } else if (req.method == 'GET') { + if (settings.minify) { + respondMinified(); + } else { + respondRaw(); + } } else { - respondRaw(); + res.writeHead(405, {'allow': 'HEAD, GET'}); + res.end(); } } });