Secure.set_headers_async()
Apply configured headers asynchronously to response.
Usage
Secure.set_headers_async(response)This method is designed for async frameworks such as FastAPI and Starlette. It transparently supports sync or async setters.
Supported Patterns
await response.set_header(name, value)for async setters.response.set_header(name, value)for sync setters returningNone.await response.headers.set(name, value)for async headers containers.response.headers.set(name, value)for sync headers containers.await response.headers.__setitem__(name, value)for async mappings.response.headers[name] = valuefor sync mappings.
Parameters
response: ResponseProtocol-
Response object implementing either
SetHeaderProtocolorHeadersProtocol.
Raises
AttributeError-
If the response lacks both
.set_headerand.headers, or if.headersdoes not support setting values. HeaderSetError- If setting an individual header fails.