Skip to content

Commit

Permalink
Added a test for 404 handling
Browse files Browse the repository at this point in the history
  • Loading branch information
naholyr committed Oct 30, 2011
1 parent 84ffd3a commit 763cb0f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/test.js
Expand Up @@ -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'))
Expand Down Expand Up @@ -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")
})

})

}
Expand Down

0 comments on commit 763cb0f

Please sign in to comment.