MCPcopy Create free account
hub / github.com/forwardemail/superagent / mapToHttpHeader

Method mapToHttpHeader

src/node/http2wrapper.js:122–143  ·  view source on GitHub ↗
(headers)

Source from the content-addressed store, hash-verified

120 }
121
122 mapToHttpHeader(headers) {
123 const keys = Object.keys(headers);
124 const http2Headers = {};
125 for (let key of keys) {
126 let value = headers[key];
127 key = key.toLowerCase();
128 // header names come from the peer; never let one such as "__proto__"
129 // reach into the prototype chain of the headers object
130 if (!isSafeKey(key)) continue;
131 switch (key) {
132 case HTTP2_HEADER_SET_COOKIE:
133 value = Array.isArray(value) ? value : [value];
134 break;
135 default:
136 break;
137 }
138
139 http2Headers[key] = value;
140 }
141
142 return http2Headers;
143 }
144
145 mapToHttp2Header(headers) {
146 const keys = Object.keys(headers);

Callers 1

getFrameMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected