Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added `getOnly` option to `connect.static.send()`

  • Loading branch information...
commit ef0f0706e797b779a43a518261611f06272e4c4e 1 parent 1ce13cb
@tj tj authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/middleware/static.js
View
5 lib/middleware/static.js
@@ -55,6 +55,7 @@ exports = module.exports = function static(root, options){
return function static(req, res, next) {
options.path = req.url;
+ options.getOnly = true;
send(req, res, next, options);
};
};
@@ -98,7 +99,9 @@ var send = exports.send = function(req, res, next, options){
var maxAge = options.maxAge || 0
, ranges = req.headers.range
, head = 'HEAD' == req.method
+ , get = 'GET' == req.method
, root = options.root ? normalize(options.root) : null
+ , getOnly = options.getOnly
, fn = options.callback
, hidden = options.hidden
, done;
@@ -107,7 +110,7 @@ var send = exports.send = function(req, res, next, options){
if (fn) next = fn;
// ignore non-GET requests
- if ('GET' != req.method && !head) return next();
+ if (getOnly && !get && !head) return next();
// parse url
var url = parse(options.path)
Please sign in to comment.
Something went wrong with that request. Please try again.