Browse files

Fixed issue 2 (e is not defined).

  • Loading branch information...
1 parent 59d8228 commit c94791adfc733ba288d66be9995a4b79cde03ba9 @gjritter committed Mar 15, 2010
Showing with 16 additions and 2 deletions.
  1. +2 −2 lib/nerve.js
  2. +3 −0 test/test_dir/README.txt
  3. +11 −0 test/test_nerve.js
View
4 lib/nerve.js
@@ -90,8 +90,8 @@
if (exists) {
fs.readFile(pathname, 'binary', function (err, data) {
if(err) {
- res.respond({content: '<html><head><title>Exception</title></head><body><h1>Exception</h1><pre>' + sys.inspect(e) + '</pre></body></html>', status_code: 501});
- sys.p(e);
+ res.respond({content: '<html><head><title>Exception</title></head><body><h1>Exception</h1><pre>' + sys.inspect(err) + '</pre></body></html>', status_code: 501});
+ sys.p(err);
} else {
res.respond({content: data, headers: {'Content-Type': mime.mime_type(pathname)}});
}
View
3 test/test_dir/README.txt
@@ -0,0 +1,3 @@
+This directory is used by one of the nerve tests to verify that a nerve
+app does not abend when an attempt is made to read a directory.
+
View
11 test/test_nerve.js
@@ -352,6 +352,17 @@
});
req.close();
}());
+
+ (function test_read_dir() {
+ var client = http.createClient(8000, '127.0.0.1'),
+ req = client.request('GET', '/test_dir');
+ expect_callback();
+ req.addListener( 'response', function(res) {
+ test.assertEquals(501, res.statusCode);
+ receive_callback();
+ });
+ req.close();
+ }());
// assert that all callbacks were called within the alloted time and exit

0 comments on commit c94791a

Please sign in to comment.