MCPcopy Index your code
hub / github.com/forwardemail/superagent / mapToHttp2Header

Method mapToHttp2Header

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

Source from the content-addressed store, hash-verified

139 }
140
141 mapToHttp2Header(headers) {
142 const keys = Object.keys(headers);
143 const http2Headers = {};
144 for (let key of keys) {
145 let value = headers[key];
146 key = key.toLowerCase();
147 switch (key) {
148 case HTTP2_HEADER_HOST:
149 key = HTTP2_HEADER_AUTHORITY;
150 value = /^http:\/\/|^https:\/\//.test(value)
151 ? new URL(value).host
152 : value;
153 break;
154 default:
155 break;
156 }
157
158 http2Headers[key] = value;
159 }
160
161 return http2Headers;
162 }
163
164 setHeader(name, value) {
165 this._headers[name.toLowerCase()] = value;

Callers 1

getFrameMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected