Permalink
Browse files

Merge pull request #7 from naholyr/patch-2

Added a test for 404 handling
  • Loading branch information...
2 parents 5bad464 + 763cb0f commit e1bfe589b0ebe069c7ffa44e233ebbc0a0ac22c7 @mikeal mikeal committed Oct 30, 2011
Showing with 12 additions and 0 deletions.
  1. +12 −0 test/test.js
View
@@ -136,6 +136,12 @@ function testhttp () {
x.pipe(resp)
})
+ s.on('/test-not-found', function (req, resp) {
+ var x = filed(__dirname + "/there-is-no-such-file-here.no-extension")
+ req.pipe(x)
+ x.pipe(resp)
+ })
+
s.listen(port, function () {
fs.createReadStream(testfile).pipe(request.put(url+'/test-req'))
@@ -189,6 +195,12 @@ function testhttp () {
console.log("Passed GET of directory index, full pipe")
})
+ request.get(url+'/test-not-found', function (e, resp, body) {
+ if (e) throw e
+ if (resp.statusCode !== 404) throw new Error('Status code is not 404 it is '+resp.statusCode)
+ console.log("Passed Not Found produces 404")
+ })
+
})
}

0 comments on commit e1bfe58

Please sign in to comment.