This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-04-09
Channels
- # announcements (4)
- # beginners (44)
- # boot (15)
- # calva (66)
- # cider (66)
- # clojure (75)
- # clojure-austin (4)
- # clojure-europe (2)
- # clojure-finland (1)
- # clojure-italy (3)
- # clojure-nl (10)
- # clojure-russia (3)
- # clojure-sg (1)
- # clojure-uk (109)
- # clojurescript (18)
- # datomic (8)
- # emacs (1)
- # figwheel-main (1)
- # fulcro (5)
- # jobs (1)
- # jobs-discuss (8)
- # kaocha (7)
- # leiningen (11)
- # luminus (2)
- # off-topic (69)
- # pathom (5)
- # re-frame (7)
- # reagent (4)
- # reitit (18)
- # ring-swagger (3)
- # shadow-cljs (123)
- # spacemacs (1)
- # sql (35)
- # tools-deps (89)
- # uncomplicate (3)
- # vim (6)
- # yada (3)
hi everyone! need some help with reitit pedestal, trying to do some tests based on this guide http://pedestal.io/guides/pedestal-with-component currently this works
(deftest some-test
(let [service-fn (get-in *system* [reitit/pedestal-reitit-http :server :io.pedestal.http/service-fn])
response (response-for service-fn :get "/math/plus?x=1&y=2")]
(is (= {:status 200
:body "{\"total\":3}"}
(select-keys response [:status :body])))))
but I still can't find a way to use io.pedestal.http.route/url-for-routes
to generate string url from reitit routes map(@andfadeev hi. You should use the reitit.core/match-by-name
instead. But it requires the instance of the router, which is not exposed into the context map. Wrote an issue of that: https://github.com/metosin/reitit/issues/255 & will fix that this week. For now, if you have a handle to thet reitit.http/router
, you can just use that:
(-> router
(reitit.core/match-by-name ::ping)
(reitit.core/match->path))
; "/ping"
thanks! i guess i can put instance of router in component along with actual http server and access it in test, I will try
Is there a bug in here?
(defn router [logger]
(rring/router
[["/status" {:get {:handler (json/wrap-json-response status-handler)}}]
["/api" {:middleware (api-middleware logger)}
["" {:get {:handler api-handler}}]]]))
(rring/ring-handler (router logger)
(-> (rring/create-resource-handler {})
wrap-gzip
wrap-head))
so this should get index.html from public folder
when request is to /
instead this happens when I point the browser to localhost
2019-04-09/15:14:30.805/UTC Roks-MacBook-Pro-3.local INFO [duct.middleware.web:16] - :duct.middleware.web/request {:request-method :get, :uri "/", :query-string nil}
2019-04-09/15:14:46.483/UTC Roks-MacBook-Pro-3.local INFO [duct.middleware.web:16] - :duct.middleware.web/request {:request-method :get, :uri "/index.html", :query-string nil}
2019-04-09/15:14:52.087/UTC Roks-MacBook-Pro-3.local INFO [duct.middleware.web:16] - :duct.middleware.web/request {:request-method :get, :uri "/index.html/index.html", :query-string nil}
2019-04-09/15:14:52.103/UTC Roks-MacBook-Pro-3.local INFO [duct.middleware.web:16] - :duct.middleware.web/request {:request-method :get, :uri "/index.html/index.html/index.html", :query-string nil}
2019-04-09/15:14:52.112/UTC Roks-MacBook-Pro-3.local INFO [duct.middleware.web:16] - :duct.middleware.web/request {:request-method :get, :uri "/index.html/index.html/index.html/index.html", :query-string nil}
2019-04-09/15:14:52.119/UTC Roks-MacBook-Pro-3.local INFO [duct.middleware.web:16] - :duct.middleware.web/request {:request-method :get, :uri "/index.html/index.html/index.html/index.html/index.html", :query-string nil}
2019-04-09/15:14:52.128/UTC Roks-MacBook-Pro-3.local INFO [duct.middleware.web:16] - :duct.middleware.web/request {:request-method :get, :uri "/index.html/index.html/index.html/index.html/index.html/index.html", :query-string nil}
I am confused, why does it keep redirecting?
You've got a bug there. https://github.com/metosin/reitit/blob/master/modules/reitit-ring/src/reitit/ring.cljc#L214
This resource-response call keeps hitting /index.html
while it completely ignores uri
getting longer and longer and longer
so it doesn;t matter which uri is passed into this function, if there's an index file present it will redirect
for some reason path is always null
How does one specify a swagger response with an empty body? For example for a response code of 204, which has not body.