HeaderPropagation class
A class that implements the HeaderPropagationCollection interface. It filters the incoming request headers based on the definition provided and loads them into the outgoing headers collection.
Constructors
| Header |
Creates a header propagation collection from incoming request headers. |
Properties
| incoming | Gets the normalized headers received on the incoming request. |
| outgoing | Gets the headers selected for propagation to outgoing requests. |
Methods
| add(Record<string, string>) | Adds headers that do not already exist in either collection. |
| concat(Record<string, string>) | Appends values to headers that already exist in either collection. |
| key(string) | Finds a known header name without regard to casing. |
| override(Record<string, string>) | Sets outgoing header values unless the headers are protected. |
| propagate(string[]) | Copies existing incoming header values to the outgoing collection. |
Constructor Details
HeaderPropagation(Record<string, string | string[] | undefined>)
Creates a header propagation collection from incoming request headers.
new HeaderPropagation(headers: Record<string, string | string[] | undefined>)
Parameters
- headers
-
Record<string, string | string[] | undefined>
The incoming headers, including optional multi-value headers.
Property Details
incoming
Gets the normalized headers received on the incoming request.
Record<string, string> incoming
Property Value
Record<string, string>
Remarks
This collection is built based on the headers received in the request.
outgoing
Gets the headers selected for propagation to outgoing requests.
Record<string, string> outgoing
Property Value
Record<string, string>
Remarks
This collection is built based on the incoming headers and the definition provided.
Method Details
add(Record<string, string>)
Adds headers that do not already exist in either collection.
function add(headers: Record<string, string>)
Parameters
- headers
-
Record<string, string>
The headers to add.
concat(Record<string, string>)
Appends values to headers that already exist in either collection.
function concat(headers: Record<string, string>)
Parameters
- headers
-
Record<string, string>
The values to append.
key(string)
Finds a known header name without regard to casing.
function key(key: string): string | undefined
Parameters
- key
-
string
The header name to find.
Returns
string | undefined
The original-cased header name, or undefined when it is unknown.
override(Record<string, string>)
Sets outgoing header values unless the headers are protected.
function override(headers: Record<string, string>)
Parameters
- headers
-
Record<string, string>
The headers to set.
propagate(string[])
Copies existing incoming header values to the outgoing collection.
function propagate(headers: string[])
Parameters
- headers
-
string[]
The header names to propagate.