CustomHeader
Wrapper for an arbitrary HTTP header.
Usage
CustomHeader()Default header value: provided by the caller at initialization.
Notes
* Header names and values are normalized via normalize_header_value to prevent header injection. * This class keeps parity with other builders via value, set, and escape-hatch helpers so it plugs into the fluent API.
Resources: - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers
Init Parameters
header: strvalue: str
Attributes
| Name | Description |
|---|---|
| header_value | Retrieve the current value of the custom header. |
header_value
Retrieve the current value of the custom header.
header_value: str
Returns
str: The value of the custom header.
Methods
| Name | Description |
|---|---|
| __init__() | Initialize a custom header name and value. |
| set() | Update the value of the custom header. |
| value() | Alias for set(), provided for parity with other headers. |
__init__()
Initialize a custom header name and value.
Usage
__init__(header, value)Parameters
header-
The header name (for example,
"X-Custom-Header"). value-
The header value to emit.
set()
Update the value of the custom header.
Usage
set(value)This method allows the value of the custom header to be updated and supports method chaining.
Parameters
value-
The new value to set for the custom header.
Returns
CustomHeader: The current instance, allowing for method chaining.
value()
Alias for set(), provided for parity with other headers.
Usage
value(value)