Secure.set_headers()

Apply configured headers synchronously to response.

Usage

Source

Secure.set_headers(response)

This method is strictly sync-only. It is suitable for synchronous frameworks or sync response objects in async frameworks.

Supported Patterns

  • response.set_header(name, value) (synchronous).
  • response.headers.set(name, value) (Werkzeug-style headers container).
  • response.headers[name] = value (mapping interface).

Parameters

response: ResponseProtocol
Response object implementing either SetHeaderProtocol or HeadersProtocol.

Raises

RuntimeError

If an async setter is detected (for example an async method is used in a sync context).

AttributeError

If the response lacks both .set_header and .headers, or if .headers does not support setting values.

HeaderSetError
If setting an individual header fails.