Clojurians
#ring-swagger
<
2017-02-22
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

eoliphant00:02:46

hi, i’m having a weird problem with compojure-api I have a simple route/api def

(GET "/authenticated" []
       :header-params [Authorization :- String]
       :auth-rules authenticated?
       :current-user user
       (ok ))
I’m sending a test request via swagger with a value filled in for Authorization in the form. But I’m getting a 400 and
{
  "errors": {
    "Authorization": "missing-required-key"
  }
}
in the body. The header (with a JWS) is going over, it gets properly processed by buddy, but compojure-api seems to think my request is malformed or something
curl -X GET --header 'Accept: application/json' --header 'Authorization: Token eyJhbGciOiJSU….

bja05:02:23

does auth-rules dissoc the request map prior to compojure-api destructuring for the header-params?

mrchance13:02:23

FYI, something I just ran into using cloverage and custom metadata handlers. Easy to get wrong I think: https://github.com/cloverage/cloverage/issues/164

ikitommi20:02:49

the header-params got that resolved via github issue. Ring lower-cases all header-keys.

plins20:02:42

hello everyone, is there a way to enable route-specific middleware? or at least api specific?

mtkp21:02:36

additional middleware fns can be added to the vector containing wrap-multipart-params

mtkp21:02:32

and i think you can also use the :middleware param in a (context ... form to apply it to a set of endpoints

plins21:02:47

this is superb! any docs showing the anatomy of a middleware?

mtkp22:02:27

a middleware function is a function that takes a handler and returns a function that takes a request