@@ -33,7 +33,7 @@ let clientEndCb = false; |
33 | 33 | let clientIncoming = ''; |
34 | 34 | const clientIncomingExpect = 'asdffoobar'; |
35 | 35 |
|
36 | | -process.on('exit', function() { |
| 36 | +process.on('exit', () => { |
37 | 37 | assert(serverEndCb); |
38 | 38 | assert.strictEqual(serverIncoming, serverIncomingExpect); |
39 | 39 | assert(clientEndCb); |
@@ -42,22 +42,22 @@ process.on('exit', function() { |
42 | 42 | }); |
43 | 43 |
|
44 | 44 | // Verify that we get a callback when we do res.write(..., cb) |
45 | | -const server = http.createServer(function(req, res) { |
| 45 | +const server = http.createServer((req, res) => { |
46 | 46 | res.statusCode = 400; |
47 | 47 | res.end('Bad Request.\nMust send Expect:100-continue\n'); |
48 | 48 | }); |
49 | 49 |
|
50 | | -server.on('checkContinue', function(req, res) { |
| 50 | +server.on('checkContinue', (req, res) => { |
51 | 51 | server.close(); |
52 | 52 | assert.strictEqual(req.method, 'PUT'); |
53 | | - res.writeContinue(function() { |
| 53 | + res.writeContinue(() => { |
54 | 54 | // continue has been written |
55 | | - req.on('end', function() { |
56 | | - res.write('asdf', function(er) { |
| 55 | + req.on('end', () => { |
| 56 | + res.write('asdf', (er) => { |
57 | 57 | assert.ifError(er); |
58 | | - res.write('foo', 'ascii', function(er) { |
| 58 | + res.write('foo', 'ascii', (er) => { |
59 | 59 | assert.ifError(er); |
60 | | - res.end(Buffer.from('bar'), 'buffer', function(er) { |
| 60 | + res.end(Buffer.from('bar'), 'buffer', (er) => { |
61 | 61 | serverEndCb = true; |
62 | 62 | }); |
63 | 63 | }); |
@@ -66,7 +66,7 @@ server.on('checkContinue', function(req, res) { |
66 | 66 | }); |
67 | 67 |
|
68 | 68 | req.setEncoding('ascii'); |
69 | | - req.on('data', function(c) { |
| 69 | + req.on('data', (c) => { |
70 | 70 | serverIncoming += c; |
71 | 71 | }); |
72 | 72 | }); |
@@ -77,24 +77,24 @@ server.listen(0, function() { |
77 | 77 | method: 'PUT', |
78 | 78 | headers: { 'expect': '100-continue' } |
79 | 79 | }); |
80 | | - req.on('continue', function() { |
| 80 | + req.on('continue', () => { |
81 | 81 | // ok, good to go. |
82 | | - req.write('YmF6', 'base64', function(er) { |
| 82 | + req.write('YmF6', 'base64', (er) => { |
83 | 83 | assert.ifError(er); |
84 | | - req.write(Buffer.from('quux'), function(er) { |
| 84 | + req.write(Buffer.from('quux'), (er) => { |
85 | 85 | assert.ifError(er); |
86 | | - req.end('626c657267', 'hex', function(er) { |
| 86 | + req.end('626c657267', 'hex', (er) => { |
87 | 87 | assert.ifError(er); |
88 | 88 | clientEndCb = true; |
89 | 89 | }); |
90 | 90 | }); |
91 | 91 | }); |
92 | 92 | }); |
93 | | - req.on('response', function(res) { |
| 93 | + req.on('response', (res) => { |
94 | 94 | // this should not come until after the end is flushed out |
95 | 95 | assert(clientEndCb); |
96 | 96 | res.setEncoding('ascii'); |
97 | | - res.on('data', function(c) { |
| 97 | + res.on('data', (c) => { |
98 | 98 | clientIncoming += c; |
99 | 99 | }); |
100 | 100 | }); |
|