in packages/dubbo-node/src/node-universal-header.ts [26:52]
export function nodeHeaderToWebHeader(
nodeHeaders:
| http.OutgoingHttpHeaders
| http.IncomingHttpHeaders
| http2.IncomingHttpHeaders
| http.IncomingMessage["trailers"]
): Headers {
const header = new Headers();
for (const [k, v] of Object.entries(nodeHeaders)) {
if (k.startsWith(":")) {
continue;
}
if (v === undefined) {
continue;
}
if (typeof v == "string") {
header.append(k, v);
} else if (typeof v == "number") {
header.append(k, String(v));
} else {
for (const e of v) {
header.append(k, e);
}
}
}
return header;
}