({ requests, streams, clients, duration })
| 14 | }, { flags: ['--no-warnings'] }); |
| 15 | |
| 16 | function main({ requests, streams, clients, duration }) { |
| 17 | const http2 = require('http2'); |
| 18 | const server = http2.createServer(); |
| 19 | server.on('request', (req, res) => { |
| 20 | const out = fs.createReadStream(file); |
| 21 | res.setHeader('content-type', 'text/html'); |
| 22 | out.pipe(res); |
| 23 | out.on('error', (err) => { |
| 24 | res.destroy(); |
| 25 | }); |
| 26 | }); |
| 27 | server.listen(0, () => { |
| 28 | bench.http({ |
| 29 | path: '/', |
| 30 | port: server.address().port, |
| 31 | requests, |
| 32 | maxConcurrentStreams: streams, |
| 33 | clients, |
| 34 | threads: clients, |
| 35 | duration, |
| 36 | }, () => { server.close(); }); |
| 37 | }); |
| 38 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…