src/lib/src/read-only-headers.ts
Interface that serves as read-only accessor to the {@link HttpHeaders}. Also allows easy custom implementation and decouples it from HTTP.
Empty header collection is provided in the {@link NO_HEADERS}.
Methods |
get | ||||||||
get(name: string)
|
||||||||
Defined in src/lib/src/read-only-headers.ts:16
|
||||||||
Returns first header that matches given name.
Parameters :
Returns :
string | null
|
getAll | ||||||||
getAll(name: string)
|
||||||||
Defined in src/lib/src/read-only-headers.ts:26
|
||||||||
Returns list of header values for a given name.
Parameters :
Returns :
[] | null
|
has | ||||||||
has(name: string)
|
||||||||
Defined in src/lib/src/read-only-headers.ts:11
|
||||||||
Checks for existence of header by given name.
Parameters :
Returns :
boolean
|
keys |
keys()
|
Defined in src/lib/src/read-only-headers.ts:21
|
Returns the names of the headers.
Returns :
string[]
|
export interface ReadOnlyHeaders {
/**
* Checks for existence of header by given name.
*/
has(name: string): boolean;
/**
* Returns first header that matches given name.
*/
get(name: string): string | null;
/**
* Returns the names of the headers.
*/
keys(): string[];
/**
* Returns list of header values for a given name.
*/
getAll(name: string): string[] | null;
}
/**
* Dummy implementation of {@link ReadOnlyHeaders} that never returns anything.
*/
export const NO_HEADERS: ReadOnlyHeaders = {
has(name: string): boolean {
return false;
},
get(name: string): string | null {
return null;
},
keys(): string[] {
return [];
},
getAll(name: string): string[] | null {
return null;
}
};