mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
test: simplify test-http-write-callbacks.js
PR-URL: https://github.com/nodejs/node/pull/42628 Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
parent
b98386c977
commit
bb762c5bd0
@ -20,7 +20,7 @@
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
'use strict';
|
||||
require('../common');
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
|
||||
const http = require('http');
|
||||
@ -53,15 +53,13 @@ server.on('checkContinue', (req, res) => {
|
||||
res.writeContinue(() => {
|
||||
// Continue has been written
|
||||
req.on('end', () => {
|
||||
res.write('asdf', (er) => {
|
||||
assert.ifError(er);
|
||||
res.write('foo', 'ascii', (er) => {
|
||||
assert.ifError(er);
|
||||
res.end(Buffer.from('bar'), 'buffer', (er) => {
|
||||
res.write('asdf', common.mustSucceed(() => {
|
||||
res.write('foo', 'ascii', common.mustSucceed(() => {
|
||||
res.end(Buffer.from('bar'), 'buffer', common.mustSucceed(() => {
|
||||
serverEndCb = true;
|
||||
});
|
||||
});
|
||||
});
|
||||
}));
|
||||
}));
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
||||
@ -79,16 +77,13 @@ server.listen(0, function() {
|
||||
});
|
||||
req.on('continue', () => {
|
||||
// ok, good to go.
|
||||
req.write('YmF6', 'base64', (er) => {
|
||||
assert.ifError(er);
|
||||
req.write(Buffer.from('quux'), (er) => {
|
||||
assert.ifError(er);
|
||||
req.end('626c657267', 'hex', (er) => {
|
||||
assert.ifError(er);
|
||||
req.write('YmF6', 'base64', common.mustSucceed(() => {
|
||||
req.write(Buffer.from('quux'), common.mustSucceed(() => {
|
||||
req.end('626c657267', 'hex', common.mustSucceed(() => {
|
||||
clientEndCb = true;
|
||||
});
|
||||
});
|
||||
});
|
||||
}));
|
||||
}));
|
||||
}));
|
||||
});
|
||||
req.on('response', (res) => {
|
||||
// This should not come until after the end is flushed out
|
||||
|
Loading…
Reference in New Issue
Block a user