Skip to content

Sending (HX-Trigger) headers in response #46

@hf-kklein

Description

@hf-kklein

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.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions