import * as O from 'fp-ts/lib/Option' ; import * as A from 'fp-ts/lib/Array' ; import { pipe } from 'fp-ts/lib/function' ; import { HttpHeaders } from '../http.interface' ; param key since export const getHeaderValue = < T extends string = string > ( key ) => ( headers ) : O . Option < T > => pipe ( O . fromNullable ( headers [ key ] ?? headers [ key . toLowerCase ( ) ] ) , O . chain ( value => Array . isArray ( value ) ? A . head ( value ) as O . Option < T > : O . some ( String ( value ) ) as O . Option < T > ) ) ; param headers since export const normalizeHeaders = ( headers ) : HttpHeaders => pipe ( Object . entries ( headers ) . map ( ( [ key , value ] ) => [ key . toLowerCase ( ) , value ] ) , Object . fromEntries ) ;