11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ciconst common = require('../common'); 31cb0ef41Sopenharmony_ciconst assert = require('assert'); 41cb0ef41Sopenharmony_ciconst http = require('http'); 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_ciconst server = http.createServer(common.mustCall(function(req, res) { 71cb0ef41Sopenharmony_ci assert.strictEqual(res.writableFinished, false); 81cb0ef41Sopenharmony_ci res 91cb0ef41Sopenharmony_ci .on('finish', common.mustCall(() => { 101cb0ef41Sopenharmony_ci assert.strictEqual(res.writableFinished, true); 111cb0ef41Sopenharmony_ci server.close(); 121cb0ef41Sopenharmony_ci })) 131cb0ef41Sopenharmony_ci .end(); 141cb0ef41Sopenharmony_ci})); 151cb0ef41Sopenharmony_ci 161cb0ef41Sopenharmony_ciserver.listen(0); 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_ciserver.on('listening', common.mustCall(function() { 191cb0ef41Sopenharmony_ci const clientRequest = http.request({ 201cb0ef41Sopenharmony_ci port: server.address().port, 211cb0ef41Sopenharmony_ci method: 'GET', 221cb0ef41Sopenharmony_ci path: '/' 231cb0ef41Sopenharmony_ci }); 241cb0ef41Sopenharmony_ci 251cb0ef41Sopenharmony_ci assert.strictEqual(clientRequest.writableFinished, false); 261cb0ef41Sopenharmony_ci clientRequest 271cb0ef41Sopenharmony_ci .on('finish', common.mustCall(() => { 281cb0ef41Sopenharmony_ci assert.strictEqual(clientRequest.writableFinished, true); 291cb0ef41Sopenharmony_ci })) 301cb0ef41Sopenharmony_ci .end(); 311cb0ef41Sopenharmony_ci assert.strictEqual(clientRequest.writableFinished, false); 321cb0ef41Sopenharmony_ci})); 33