MCPcopy Index your code
hub / github.com/nodejs/node / main

Function main

benchmark/http/incoming_headers.js:12–43  ·  view source on GitHub ↗
({ connections, headers, w, duration })

Source from the content-addressed store, hash-verified

10});
11
12function main({ connections, headers, w, duration }) {
13 const server = http.createServer((req, res) => {
14 res.end();
15 });
16
17 server.listen(0, () => {
18 const headers = {
19 'Content-Type': 'text/plain',
20 'Accept': 'text/plain',
21 'User-Agent': 'nodejs-benchmark',
22 'Date': new Date().toString(),
23 'Cache-Control': 'no-cache',
24 };
25 for (let i = 0; i < headers; i++) {
26 // Note:
27 // - autocannon does not send header values with OWS
28 // - wrk can only send trailing OWS. This is a side-effect of wrk
29 // processing requests with http-parser before sending them, causing
30 // leading OWS to be stripped.
31 headers[`foo${i}`] = `some header value ${i}${' \t'.repeat(w / 2)}`;
32 }
33 bench.http({
34 path: '/',
35 connections,
36 headers,
37 duration,
38 port: server.address().port,
39 }, () => {
40 server.close();
41 });
42 });
43}

Callers

nothing calls this directly

Calls 6

listenMethod · 0.80
httpMethod · 0.80
addressMethod · 0.65
closeMethod · 0.65
endMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…