reitit
reitit copied to clipboard
Support headers coercion in ring responses
It would be nice to be able to validate/coerce headers in ring responses like so:
["authorize"
{:name ::authorize
:get {:responses {302 {:headers {:location url?}}}
:parameters {:query authorize-params}
:handler (authorize! origin)}}
Unless this is this already supported and my syntax incorrect? I also tried {:headers {"Location" url?}}
The docs do seem to suggest only :body
is supported:
Responses are defined in route data under :responses key. It’s value should be a map of http status code to a map which can contain :body key with Coercion Schema as value.
le bump
This also affects Swagger UI, if I'm not mistaken? I'm using Malli coercion, and if I try something like the above I get a single header listed whose name is just "1":
Looking at the code, I think it's just not transforming the schema for :headers
le bump encore
I also have a Location
header that I would like documented for a 201 resource created response.
I'm wondering what the correct syntax should be, for a time when this might be supported in the future (so that I can add it now in anticipation of it working some day).