This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-07-11
Channels
- # aws (15)
- # beginners (55)
- # boot (116)
- # bristol-clojurians (2)
- # cider (4)
- # cljs-dev (439)
- # cljsrn (14)
- # clojure (135)
- # clojure-argentina (3)
- # clojure-czech (4)
- # clojure-italy (60)
- # clojure-russia (1)
- # clojure-spec (48)
- # clojure-uk (42)
- # clojurescript (170)
- # cloverage (11)
- # core-async (19)
- # cursive (13)
- # datomic (48)
- # emacs (2)
- # graphql (3)
- # hoplon (8)
- # jobs (1)
- # jobs-discuss (5)
- # klipse (11)
- # luminus (5)
- # lumo (5)
- # mount (48)
- # off-topic (96)
- # om (17)
- # onyx (14)
- # parinfer (30)
- # protorepl (1)
- # re-frame (90)
- # reagent (2)
- # remote-jobs (1)
- # spacemacs (12)
- # specter (20)
- # uncomplicate (1)
- # untangled (65)
- # vim (2)
- # yada (8)
Yes. In fact, yada depends on buddy for some security features. See ext/oauth2 and ext/jwt
Sounds good! Thanks @malcolmsparks
Are there any examples testing a mock POST request with a body?
I'm having trouble replicating the behaviour that the web server does
(defn response-for
"Same as yada.test response-for, but returns a Clojure data body.
Produces yada responses for a number of types. Maps are interpreted
as resource-maps, vectors are bidi routes. If you want these as
bodies, use (response-for {:response …})"
([o]
(response-for o :get "/" {}))
([o method]
(response-for o method "/" {}))
([o method uri]
(response-for o method uri {}))
([o method uri options]
(let [h (as-handler o)
response @(h (yada/request-for method uri options))]
(cond-> response
(:body response) (update :body (comp edn/read-string b/to-string))))))
(defn response-for-query
([o named-query]
(response-for-query o named-query {}))
([o named-query params]
(response-for o :get (str "/queries/" (cqrs/query-url named-query)) params)))
(defn response-for-command
([o command]
(response-for o :post "/commands/" {:headers {"content-type" "application/edn"}
:body (b/to-byte-buffer (prn-str command))})))
I have this ^^and in response-for-command
I'm trying to create a body that is readable by Yada
Ah, the bit I was missing is that I wasn't setting a content-length