In plain FastAPI I can add headers to my response as described here
def get_headers(response: Response):
response.headers["X-Cat-Dog"] = "alone in the world"
return {"foo": "bar"} # this is fed to the jinja2 template
But this doesn't work when using an @htmx decorated endpoint.
The response and its headers are ignored and overwritten with the Template response.
Seems like a bug or at least missing feature to me.
In plain FastAPI I can add headers to my response as described here
But this doesn't work when using an
@htmxdecorated endpoint.The response and its headers are ignored and overwritten with the Template response.
Seems like a bug or at least missing feature to me.