@nestia/core
Version:
Super-fast validation decorators of NestJS
14 lines (12 loc) • 332 B
text/typescript
import http from "http";
/**
* @internal
*/
export function headers_to_object(
headers: http.IncomingHttpHeaders,
): Record<string, string> {
const output: Record<string, string> = {};
for (const [key, value] of Object.entries(headers))
output[key] = value instanceof Array ? value[0] : value || "";
return output;
}