11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_cirequire('../common'); 31cb0ef41Sopenharmony_ciconst assert = require('assert'); 41cb0ef41Sopenharmony_ciconst http = require('http'); 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_ciconst server = http.createServer(); 71cb0ef41Sopenharmony_ciserver.on('request', function(req, res) { 81cb0ef41Sopenharmony_ci assert.strictEqual(req.headers.foo, 'bar'); 91cb0ef41Sopenharmony_ci res.end('ok'); 101cb0ef41Sopenharmony_ci server.close(); 111cb0ef41Sopenharmony_ci}); 121cb0ef41Sopenharmony_ciserver.listen(0, '127.0.0.1', function() { 131cb0ef41Sopenharmony_ci const req = http.request({ 141cb0ef41Sopenharmony_ci method: 'GET', 151cb0ef41Sopenharmony_ci host: '127.0.0.1', 161cb0ef41Sopenharmony_ci port: this.address().port, 171cb0ef41Sopenharmony_ci }); 181cb0ef41Sopenharmony_ci req.setHeader('foo', 'bar'); 191cb0ef41Sopenharmony_ci req.flushHeaders(); 201cb0ef41Sopenharmony_ci}); 21