mirror of
https://github.com/nodejs/node.git
synced 2024-11-24 20:29:23 +01:00
cad76da198
This commit updates ClientRequest#destroy() to return `this` for consistency with other writable streams. PR-URL: https://github.com/nodejs/node/pull/32789 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
14 lines
472 B
JavaScript
14 lines
472 B
JavaScript
'use strict';
|
|
|
|
// Test that http.ClientRequest,prototype.destroy() returns `this`.
|
|
require('../common');
|
|
|
|
const assert = require('assert');
|
|
const http = require('http');
|
|
const clientRequest = new http.ClientRequest({ createConnection: () => {} });
|
|
|
|
assert.strictEqual(clientRequest.destroyed, false);
|
|
assert.strictEqual(clientRequest.destroy(), clientRequest);
|
|
assert.strictEqual(clientRequest.destroyed, true);
|
|
assert.strictEqual(clientRequest.destroy(), clientRequest);
|