Skip to content

Commit

Permalink
Support GET and HEAD.
Browse files Browse the repository at this point in the history
  • Loading branch information
cweider committed Feb 20, 2012
1 parent a09e208 commit a5365f2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion node/server.js
Expand Up @@ -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)
Expand Down
14 changes: 11 additions & 3 deletions node/utils/Minify.js
Expand Up @@ -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();
}
}
});
Expand Down

0 comments on commit a5365f2

Please sign in to comment.