judgevet.adapters.outbound.gateway_headers
Status: draft.
judgevet.adapters.outbound.gateway_headers
Validate bounded explicit HTTP fields without including values in errors.
Names follow RFC 9110 sections 5.1 and 5.6.2. Values use a stricter local ASCII subset than section 5.5. Limits below are judgevet policy, not vendor limits. See https://www.rfc-editor.org/rfc/rfc9110.html#section-5.
Examples:
from judgevet.adapters.outbound.gateway_headers import snapshot_headers
assert snapshot_headers({"Example-Tenant": "synthetic"}) == {
"example-tenant": "synthetic"
}
See Also
- judgevet.adapters.outbound.gateway: Public gateway configuration.
field_name(name)
Validate and normalize one field name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Caller-selected HTTP field name. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Lowercase ASCII token. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the name violates local syntax or length rules. |
field_value(value)
Validate printable ASCII without stripping caller values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str
|
Explicit field content or credential. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Unchanged validated text. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the value contains unsafe characters or edge spaces. |
snapshot_headers(headers)
Copy, normalize and bound a caller metadata map.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
headers
|
Mapping[str, str] | None
|
Explicit metadata or None for no fields. |
required |
Returns:
| Type | Description |
|---|---|
Mapping[str, str]
|
Immutable validated mapping with values excluded from diagnostics. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If fields are invalid, duplicated, protected or oversized. |