| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 0af368c commit 2e7b7b7
6 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -38,16 +38,18 @@ server.listen(0, common.mustCall(() => { | |||
| 38 | 38 | response += chunk; | |
| 39 | 39 | })); | |
| 40 | 40 | ||
| 41 | - const errOrEnd = common.mustSucceed(function(err) { | ||
| 41 | + client.on('error', () => { | ||
| 42 | + // Ignore errors like 'write EPIPE' that might occur while the request is | ||
| 43 | + // sent. | ||
| 44 | + }); | ||
| 45 | + | ||
| 46 | + client.on('close', common.mustCall(() => { | ||
| 42 | 47 | assert.strictEqual( | |
| 43 | 48 | response, | |
| 44 | 49 | 'HTTP/1.1 408 Request Timeout\r\nConnection: close\r\n\r\n' | |
| 45 | 50 | ); | |
| 46 | 51 | server.close(); | |
| 47 | - }); | ||
| 48 | - | ||
| 49 | - client.on('end', errOrEnd); | ||
| 50 | - client.on('error', errOrEnd); | ||
| 52 | + })); | ||
| 51 | 53 | ||
| 52 | 54 | client.resume(); | |
| 53 | 55 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -38,16 +38,18 @@ server.listen(0, common.mustCall(() => { | |||
| 38 | 38 | response += chunk; | |
| 39 | 39 | })); | |
| 40 | 40 | ||
| 41 | - const errOrEnd = common.mustSucceed(function(err) { | ||
| 41 | + client.on('error', () => { | ||
| 42 | + // Ignore errors like 'write EPIPE' that might occur while the request is | ||
| 43 | + // sent. | ||
| 44 | + }); | ||
| 45 | + | ||
| 46 | + client.on('close', common.mustCall(() => { | ||
| 42 | 47 | assert.strictEqual( | |
| 43 | 48 | response, | |
| 44 | 49 | 'HTTP/1.1 408 Request Timeout\r\nConnection: close\r\n\r\n' | |
| 45 | 50 | ); | |
| 46 | 51 | server.close(); | |
| 47 | - }); | ||
| 48 | - | ||
| 49 | - client.on('end', errOrEnd); | ||
| 50 | - client.on('error', errOrEnd); | ||
| 52 | + })); | ||
| 51 | 53 | ||
| 52 | 54 | client.resume(); | |
| 53 | 55 | client.write('GET / HTTP/1.1\r\n'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -45,6 +45,19 @@ server.listen(0, common.mustCall(() => { | |||
| 45 | 45 | response += chunk; | |
| 46 | 46 | })); | |
| 47 | 47 | ||
| 48 | + client.on('error', () => { | ||
| 49 | + // Ignore errors like 'write EPIPE' that might occur while the request is | ||
| 50 | + // sent. | ||
| 51 | + }); | ||
| 52 | + | ||
| 53 | + client.on('close', common.mustCall(() => { | ||
| 54 | + assert.strictEqual( | ||
| 55 | + response, | ||
| 56 | + 'HTTP/1.1 408 Request Timeout\r\nConnection: close\r\n\r\n' | ||
| 57 | + ); | ||
| 58 | + server.close(); | ||
| 59 | + })); | ||
| 60 | + | ||
| 48 | 61 | client.resume(); | |
| 49 | 62 | client.write('POST / HTTP/1.1\r\n'); | |
| 50 | 63 | client.write('Host: example.com\r\n'); | |
@@ -57,15 +70,4 @@ server.listen(0, common.mustCall(() => { | |||
| 57 | 70 | client.write('12345678901234567890\r\n\r\n'); | |
| 58 | 71 | }, common.platformTimeout(requestTimeout * 2)).unref(); | |
| 59 | 72 | }); | |
| 60 | - | ||
| 61 | - const errOrEnd = common.mustSucceed(function(err) { | ||
| 62 | - assert.strictEqual( | ||
| 63 | - response, | ||
| 64 | - 'HTTP/1.1 408 Request Timeout\r\nConnection: close\r\n\r\n' | ||
| 65 | - ); | ||
| 66 | - server.close(); | ||
| 67 | - }); | ||
| 68 | - | ||
| 69 | - client.on('end', errOrEnd); | ||
| 70 | - client.on('error', errOrEnd); | ||
| 71 | 73 | })); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -33,16 +33,18 @@ server.listen(0, common.mustCall(() => { | |||
| 33 | 33 | response += chunk; | |
| 34 | 34 | })); | |
| 35 | 35 | ||
| 36 | - const errOrEnd = common.mustSucceed(function(err) { | ||
| 36 | + client.on('error', () => { | ||
| 37 | + // Ignore errors like 'write EPIPE' that might occur while the request is | ||
| 38 | + // sent. | ||
| 39 | + }); | ||
| 40 | + | ||
| 41 | + client.on('close', common.mustCall(() => { | ||
| 37 | 42 | assert.strictEqual( | |
| 38 | 43 | response, | |
| 39 | 44 | 'HTTP/1.1 408 Request Timeout\r\nConnection: close\r\n\r\n' | |
| 40 | 45 | ); | |
| 41 | 46 | server.close(); | |
| 42 | - }); | ||
| 43 | - | ||
| 44 | - client.on('end', errOrEnd); | ||
| 45 | - client.on('error', errOrEnd); | ||
| 47 | + })); | ||
| 46 | 48 | ||
| 47 | 49 | client.resume(); | |
| 48 | 50 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -45,16 +45,18 @@ server.listen(0, common.mustCall(() => { | |||
| 45 | 45 | response += chunk; | |
| 46 | 46 | })); | |
| 47 | 47 | ||
| 48 | - const errOrEnd = common.mustSucceed(function(err) { | ||
| 48 | + client.on('error', () => { | ||
| 49 | + // Ignore errors like 'write EPIPE' that might occur while the request is | ||
| 50 | + // sent. | ||
| 51 | + }); | ||
| 52 | + | ||
| 53 | + client.on('close', common.mustCall(() => { | ||
| 49 | 54 | assert.strictEqual( | |
| 50 | 55 | response, | |
| 51 | 56 | 'HTTP/1.1 408 Request Timeout\r\nConnection: close\r\n\r\n' | |
| 52 | 57 | ); | |
| 53 | 58 | server.close(); | |
| 54 | - }); | ||
| 55 | - | ||
| 56 | - client.on('error', errOrEnd); | ||
| 57 | - client.on('end', errOrEnd); | ||
| 59 | + })); | ||
| 58 | 60 | ||
| 59 | 61 | client.resume(); | |
| 60 | 62 | client.write('POST / HTTP/1.1\r\n'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -33,16 +33,18 @@ server.listen(0, common.mustCall(() => { | |||
| 33 | 33 | response += chunk; | |
| 34 | 34 | })); | |
| 35 | 35 | ||
| 36 | - const errOrEnd = common.mustSucceed(function(err) { | ||
| 36 | + client.on('error', () => { | ||
| 37 | + // Ignore errors like 'write EPIPE' that might occur while the request is | ||
| 38 | + // sent. | ||
| 39 | + }); | ||
| 40 | + | ||
| 41 | + client.on('close', common.mustCall(() => { | ||
| 37 | 42 | assert.strictEqual( | |
| 38 | 43 | response, | |
| 39 | 44 | 'HTTP/1.1 408 Request Timeout\r\nConnection: close\r\n\r\n' | |
| 40 | 45 | ); | |
| 41 | 46 | server.close(); | |
| 42 | - }); | ||
| 43 | - | ||
| 44 | - client.on('end', errOrEnd); | ||
| 45 | - client.on('error', errOrEnd); | ||
| 47 | + })); | ||
| 46 | 48 | ||
| 47 | 49 | client.resume(); | |
| 48 | 50 | client.write('GET / HTTP/1.1\r\n'); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments