Skip to content

Commit 327543b

Browse files
committed
1 parent 40d1897 commit 327543b

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

HISTORY.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
unreleased
2+
==========
3+
4+
* Fix regression when `root` is incorrectly set to a file
5+
6+
17
1.13.0 / 2017-09-27
28
===================
39

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"encodeurl": "~1.0.1",
1010
"escape-html": "~1.0.3",
1111
"parseurl": "~1.3.2",
12-
"send": "0.16.0"
12+
"send": "0.16.1"
1313
},
1414
"devDependencies": {
1515
"eslint": "3.19.0",

test/test.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,34 @@ describe('serveStatic()', function () {
722722
})
723723
})
724724

725+
//
726+
// NOTE: This is not a real part of the API, but
727+
// over time this has become something users
728+
// are doing, so this will prevent unseen
729+
// regressions around this use-case.
730+
//
731+
describe('when mounted "root" as a file', function () {
732+
var server
733+
before(function () {
734+
server = createServer(fixtures + '/todo.txt', null, function (req) {
735+
req.originalUrl = req.url
736+
req.url = '/' + req.url.split('/').slice(2).join('/')
737+
})
738+
})
739+
740+
it('should load the file when on trailing slash', function (done) {
741+
request(server)
742+
.get('/todo')
743+
.expect(200, '- groceries', done)
744+
})
745+
746+
it('should 404 when trailing slash', function (done) {
747+
request(server)
748+
.get('/todo/')
749+
.expect(404, done)
750+
})
751+
})
752+
725753
describe('when responding non-2xx or 304', function () {
726754
var server
727755
before(function () {

0 commit comments

Comments
 (0)