Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix passthrough behavior when index:false

close #10

added failing test for passthrough with index: false

fix failing test for passthrough with index: false
  • Loading branch information...
commit 2d8c0f18b76525b42c3221543cc2266accec74c2 1 parent 0241737
@coderarity coderarity authored committed
Showing with 13 additions and 7 deletions.
  1. +3 −0  st.js
  2. +10 −7 test/passthrough.js
View
3  st.js
@@ -222,6 +222,9 @@ Mount.prototype.serve = function (req, res, next) {
res.setHeader('etag', etag)
if (stat.isDirectory()) {
+ if (this.opt.passthrough === true && this._index === false) {
+ return next();
+ }
return this.index(p, req, res)
}
View
17 test/passthrough.js
@@ -4,7 +4,7 @@ var util = require('util')
var path = require('path')
var opts = util._extend({
- autoindex: true,
+ index: false,
path: path.resolve(__dirname, './fixtures'),
url: '/',
passthrough: true
@@ -21,12 +21,15 @@ test('call next() if passthrough is set', function (t) {
setHeader: function () {},
end: function () {}
}
- t.plan(1)
- function next() {
- t.ok(true, "next called")
- t.end()
- }
- mount(req, res, next)
+ t.plan(2)
+ mount(req, res, function () {
+ t.ok(true, "next called with nonexistant file");
+ req.url='/';
+ mount(req, res, function () {
+ t.ok(true, "next called without indexing")
+ t.end()
+ });
+ })
})
var opts2 = util._extend({
Please sign in to comment.
Something went wrong with that request. Please try again.