/**
 * A collection of HttpHeaders that can be sent with a HTTP request.
 */ function getHeaderKey ( headerName ) { return headerName . toLowerCase ( ) ; } /**
 * An individual header within a HttpHeaders collection.
 */ export interface HttpHeader { /**
     * The name of the header.
     */ name : string ; /**
     * The value of the header.
     */ value : string ; } /**
 * A HttpHeaders collection represented as a simple JSON object.
 */ export type RawHttpHeaders = { [ headerName ] : string ; } ; /**
 * A collection of HTTP header key/value pairs.
 */ export interface HttpHeadersLike { param headerName param headerValue set ( headerName , headerValue ) : void ; param headerName get ( headerName ) : string | undefined ; /**
     * Get whether or not this header collection contains a header entry for the provided header name.
     */ contains ( headerName ) : boolean ; param headerName remove ( headerName ) : boolean ; /**
     * Get the headers that are contained this collection as an object.
     */ rawHeaders ( ) : RawHttpHeaders ; /**
     * Get the headers that are contained in this collection as an array.
     */ headersArray ( ) : HttpHeader [ ] ; /**
     * Get the header names that are contained in this collection.
     */ headerNames ( ) : string [ ] ; /**
     * Get the header values that are contained in this collection.
     */ headerValues ( ) : string [ ] ; /**
     * Create a deep clone/copy of this HttpHeaders collection.
     */ clone ( ) : HttpHeadersLike ; /**
     * Get the JSON object representation of this HTTP header collection.
     * The result is the same as `rawHeaders()`.
     */ toJson ( ) : RawHttpHeaders ; } export function isHttpHeadersLike ( object ? ) { if ( ! object || typeof object !== "object" ) { return false ; } if ( typeof object . rawHeaders === "function" && typeof object . clone === "function" && typeof object . get === "function" && typeof object . set === "function" && typeof object . contains === "function" && typeof object . remove === "function" && typeof object . headersArray === "function" && typeof object . headerValues === "function" && typeof object . headerNames === "function" && typeof object . toJson === "function" ) { return true ; } return false ; } /**
 * A collection of HTTP header key/value pairs.
 */ export class HttpHeaders { private readonly _headersMap : { [ headerKey ] : HttpHeader ; } ; constructor ( rawHeaders ? ) { this . _headersMap = { } ; if ( rawHeaders ) { for ( const headerName in rawHeaders ) { this . set ( headerName , rawHeaders [ headerName ] ) ; } } } param headerName param headerValue public set ( headerName , headerValue ) { this . _headersMap [ getHeaderKey ( headerName ) ] = { name : headerName , value : headerValue . toString ( ) , } ; } param headerName public get ( headerName ) { const header = this . _headersMap [ getHeaderKey ( headerName ) ] ; return ! header ? undefined : header . value ; } /**
     * Get whether or not this header collection contains a header entry for the provided header name.
     */ public contains ( headerName ) { return ! ! this . _headersMap [ getHeaderKey ( headerName ) ] ; } param headerName public remove ( headerName ) { const result = this . contains ( headerName ) ; delete this . _headersMap [ getHeaderKey ( headerName ) ] ; return result ; } /**
     * Get the headers that are contained this collection as an object.
     */ public rawHeaders ( ) { const result = { } ; for ( const headerKey in this . _headersMap ) { const header = this . _headersMap [ headerKey ] ; result [ header . name . toLowerCase ( ) ] = header . value ; } return result ; } /**
     * Get the headers that are contained in this collection as an array.
     */ public headersArray ( ) { const headers = [ ] ; for ( const headerKey in this . _headersMap ) { headers . push ( this . _headersMap [ headerKey ] ) ; } return headers ; } /**
     * Get the header names that are contained in this collection.
     */ public headerNames ( ) { const headerNames = [ ] ; const headers = this . headersArray ( ) ; for ( let i = 0 ; i < headers . length ; ++ i ) { headerNames . push ( headers [ i ] . name ) ; } return headerNames ; } /**
     * Get the header names that are contained in this collection.
     */ public headerValues ( ) { const headerValues = [ ] ; const headers = this . headersArray ( ) ; for ( let i = 0 ; i < headers . length ; ++ i ) { headerValues . push ( headers [ i ] . value ) ; } return headerValues ; } /**
     * Get the JSON object representation of this HTTP header collection.
     */ public toJson ( ) { return this . rawHeaders ( ) ; } /**
     * Get the string representation of this HTTP header collection.
     */ public toString ( ) { return JSON . stringify ( this . toJson ( ) ) ; } /**
     * Create a deep clone/copy of this HttpHeaders collection.
     */ public clone ( ) { return new HttpHeaders ( this . rawHeaders ( ) ) ; } }