This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-10-23
Channels
- # 100-days-of-code (2)
- # aws (1)
- # beginners (105)
- # boot (36)
- # calva (4)
- # cider (56)
- # clara (37)
- # cljdoc (16)
- # cljs-dev (19)
- # clojure (44)
- # clojure-dev (20)
- # clojure-italy (24)
- # clojure-nl (3)
- # clojure-serbia (2)
- # clojure-spec (15)
- # clojure-uk (44)
- # clojurescript (41)
- # code-reviews (3)
- # core-async (12)
- # cursive (24)
- # datomic (4)
- # emacs (1)
- # figwheel-main (10)
- # fulcro (168)
- # funcool (2)
- # hyperfiddle (15)
- # jobs (2)
- # jobs-discuss (79)
- # juxt (19)
- # lein-figwheel (1)
- # leiningen (2)
- # luminus (14)
- # mount (8)
- # nrepl (9)
- # off-topic (9)
- # other-languages (1)
- # pathom (32)
- # reitit (6)
- # ring-swagger (3)
- # shadow-cljs (10)
- # slack-help (11)
- # spacemacs (20)
- # sql (29)
- # tools-deps (28)
- # vim (29)
- # yada (4)
How come that this handler is returning body as ByteArrayInputStream
instead of plain JSON?
(defroutes users
(context "/bizzi-test/users" []
(GET "/" []
:summary "Gets all users"
(ok {:message "Get all users"}))))
(def handler
(api {:swagger
{:ui "/docs"
:spec "/swagger.json"
:data {:info {:title "Bizziapp REST API documentation"
:description "Documentation which describes all REST endpoints provided by Bizziapp"}
:produces ["application/json"]
:consumes ["application/json"]}}}
users
(undocumented (route/not-found (not-found {:message "This route had not been found"})))))
I tested it with a ring-mock (handler (mock/request :get "/users"))
. Thanks for answer 🙂@petr.mensik c-api uses Muuntaja under the hoods, which return InputStreams by default (can be changed to return byte-arrays or lazy streams instead). You can slurp
the body to get the string value.
@ikitommi thanks a lot 🙂 Btw is there an easy way how to generate swagger.json
file out of the API docs described with Schema (let's from the code above) ? I am going through ring-swagger and I cannot find any obvious answers there 😕