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

Function prepareResponseHeaders

lib/internal/http2/core.js:2591–2616  ·  view source on GitHub ↗
(stream, headersParam, options)

Source from the content-addressed store, hash-verified

2589}
2590
2591function prepareResponseHeaders(stream, headersParam, options) {
2592 let headers;
2593 let statusCode;
2594
2595 if (ArrayIsArray(headersParam)) {
2596 ({
2597 headers,
2598 statusCode,
2599 } = prepareResponseHeadersArray(headersParam, options));
2600 stream[kRawHeaders] = headers;
2601 } else {
2602 ({
2603 headers,
2604 statusCode,
2605 } = prepareResponseHeadersObject(headersParam, options));
2606 stream[kSentHeaders] = headers;
2607 }
2608
2609 const headersList = buildNgHeaderString(
2610 headers,
2611 assertValidPseudoHeaderResponse,
2612 stream.session[kStrictSingleValueFields],
2613 );
2614
2615 return { headers, headersList, statusCode };
2616}
2617
2618function prepareResponseHeadersObject(oldHeaders, options) {
2619 assertIsObject(oldHeaders, 'headers', ['Object', 'Array']);

Callers 1

respondMethod · 0.85

Calls 3

buildNgHeaderStringFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…