Fork me on GitHub
#ring-swagger
<
2017-03-22
>
leena07:03:58

Is it possible to add response headers in compojure-api per endpoint?

ikitommi07:03:42

yes it is, endpoints return response maps, you can set headers there. there are helpers in ring.util.http-response.

leena07:03:12

Are there any examples?

ikitommi07:03:11

the header fn comes from r.u.h-r. but response maps are just Ring maps, they have :status, :body and :headers. you can just say (-> (ok “kikka”) (assoc-in [:headers “my-header”] “my-value”))

leena07:03:29

ok, thanks, works!

peyotz12:03:06

hey, has anyone here been able to successfully use jwt for authorizing the swagger-ui docs page?

peyotz12:03:19

I’ve been using liberator for my routes, with jwt auth. I recently found out about compojure-api, and I integrated the swagger docs and the compojure-api route definitions with my liberator routes, and it all works great. What I’m currently a little stumped on is the JWT auth. I see that swagger-ui supports some types of auth out of the box, but I was wondering if it was possible to integrate with jwt

ikitommi12:03:33

that’s just for the docs, you have to have some auth-mw in place also.

peyotz13:03:52

thanks @ikitommi, I’ll give it a shot

ikitommi13:03:13

discussed few times already, would be awesome if someone had the time to abstract the auth into the lib. Shouldn’t be that hard, new api-options & mw. Looking for awesome contribution from someone 🙂

ikitommi13:03:41

(original issue for this is from 2.7.2015)

plins14:03:30

@mtkp thx! ive added a little example to the docs, i hope its ok