| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,9 +10,6 @@ if (common.hasCrypto) { | |||
| 10 | 10 | console.log('1..0 # Skipped: missing crypto'); | |
| 11 | 11 | } | |
| 12 | 12 | ||
| 13 | - var expected_bad_requests = 0; | ||
| 14 | - var actual_bad_requests = 0; | ||
| 15 | - | ||
| 16 | 13 | var host = '********'; | |
| 17 | 14 | host += host; | |
| 18 | 15 | host += host; | |
@@ -25,23 +22,20 @@ function do_not_call() { | |||
| 25 | 22 | } | |
| 26 | 23 | ||
| 27 | 24 | function test(mod) { | |
| 28 | - expected_bad_requests += 2; | ||
| 29 | 25 | ||
| 30 | 26 | // Bad host name should not throw an uncatchable exception. | |
| 31 | 27 | // Ensure that there is time to attach an error listener. | |
| 32 | - var req = mod.get({host: host, port: 42}, do_not_call); | ||
| 33 | - req.on('error', function(err) { | ||
| 28 | + var req1 = mod.get({host: host, port: 42}, do_not_call); | ||
| 29 | + req1.on('error', common.mustCall(function(err) { | ||
| 34 | 30 | assert.equal(err.code, 'ENOTFOUND'); | |
| 35 | - actual_bad_requests++; | ||
| 36 | - }); | ||
| 37 | - // http.get() called req.end() for us | ||
| 31 | + })); | ||
| 32 | + // http.get() called req1.end() for us | ||
| 38 | 33 | ||
| 39 | - var req = mod.request({method: 'GET', host: host, port: 42}, do_not_call); | ||
| 40 | - req.on('error', function(err) { | ||
| 34 | + var req2 = mod.request({method: 'GET', host: host, port: 42}, do_not_call); | ||
| 35 | + req2.on('error', common.mustCall(function(err) { | ||
| 41 | 36 | assert.equal(err.code, 'ENOTFOUND'); | |
| 42 | - actual_bad_requests++; | ||
| 43 | - }); | ||
| 44 | - req.end(); | ||
| 37 | + })); | ||
| 38 | + req2.end(); | ||
| 45 | 39 | } | |
| 46 | 40 | ||
| 47 | 41 | if (common.hasCrypto) { | |
@@ -51,7 +45,3 @@ if (common.hasCrypto) { | |||
| 51 | 45 | } | |
| 52 | 46 | ||
| 53 | 47 | test(http); | |
| 54 | - | ||
| 55 | - process.on('exit', function() { | ||
| 56 | - assert.equal(actual_bad_requests, expected_bad_requests); | ||
| 57 | - }); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -37,10 +37,10 @@ function runAb(opts, callback) { | |||
| 37 | 37 | var m = /Document Length:\s*(\d+) bytes/mi.exec(stdout); | |
| 38 | 38 | var documentLength = parseInt(m[1]); | |
| 39 | 39 | ||
| 40 | - var m = /Complete requests:\s*(\d+)/mi.exec(stdout); | ||
| 40 | + m = /Complete requests:\s*(\d+)/mi.exec(stdout); | ||
| 41 | 41 | var completeRequests = parseInt(m[1]); | |
| 42 | 42 | ||
| 43 | - var m = /HTML transferred:\s*(\d+) bytes/mi.exec(stdout); | ||
| 43 | + m = /HTML transferred:\s*(\d+) bytes/mi.exec(stdout); | ||
| 44 | 44 | var htmlTransfered = parseInt(m[1]); | |
| 45 | 45 | ||
| 46 | 46 | assert.equal(bodyLength, documentLength); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -260,7 +260,7 @@ function expectBody(expected) { | |||
| 260 | 260 | assert.equal(versionMajor, 1); | |
| 261 | 261 | assert.equal(versionMinor, 0); | |
| 262 | 262 | ||
| 263 | - var headers = headers || parser.headers; | ||
| 263 | + headers = headers || parser.headers; | ||
| 264 | 264 | ||
| 265 | 265 | assert.equal(headers.length, 2 * 256); // 256 key/value pairs | |
| 266 | 266 | for (var i = 0; i < headers.length; i += 2) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments