Skip to content

How to set headers, especially in middleware #11

@benstevens48

Description

@benstevens48

I'm very new to this, so sorry if this makes no sense.

If I have a handler which returns a vector like [::response/ok "Hello"] then I can't see how to set any custom headers on the response. It seems like you need to return a map instead, but then you have to include the content type explicitly as well which is a bit inconvenient.

This seems to be even more of an issue in middleware. If my handler returns a map then I can set the headers in middleware as in the example in the readme (although I think there is a typo - it should be :headers not :header). However, if the handler returns a vector then this throws an error (obviously, but it took me some time to work this out since I assumed that I could just copy and paste stuff from the readme!). I don't know how to write middleware that can handle both scenarios.

If there's any easy way around these issues, it would be great if it could be documented.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions