This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-12-12
Channels
- # adventofcode (67)
- # announcements (8)
- # babashka (46)
- # beginners (154)
- # calva (5)
- # cider (9)
- # clara (5)
- # clj-kondo (34)
- # cljdoc (31)
- # cljsrn (4)
- # clojure (146)
- # clojure-europe (5)
- # clojure-italy (3)
- # clojure-losangeles (2)
- # clojure-nl (149)
- # clojure-spec (22)
- # clojure-uk (73)
- # clojured (6)
- # clojurescript (95)
- # clojureverse-ops (3)
- # cryogen (7)
- # cursive (12)
- # data-science (1)
- # datomic (9)
- # docker (1)
- # emacs (1)
- # figwheel-main (1)
- # hyperfiddle (1)
- # jobs (3)
- # malli (29)
- # nrepl (2)
- # off-topic (61)
- # pathom (6)
- # pedestal (1)
- # planck (1)
- # reitit (19)
- # shadow-cljs (52)
- # spacemacs (5)
- # tools-deps (24)
- # vim (30)
- # yada (6)
I'm trying to using spec coercion with pedestal, but it seems that the exception-interceptor doesn't work properly.
clojure.lang.ExceptionInfo: clojure.lang.ExceptionInfo in Interceptor :reitit.http.interceptors.muuntaja/format-response - Malformed application/json in :muuntaja/encode
{:enter nil,
:error #<reitit.pedestal$error_arity_2__GT_1$fn__17968@8ddb7de>,
:leave nil,
:name :reitit.http.interceptors.exception/exception,
:spec :reitit.http.interceptors.exception/spec}
i'm sure this has been answered many times but i can't seem to find it in the docs/issues. can i serve a static resource in such a way that requests to /*
provide my index.html without appending index.html
to the url?
@joshkh it should work oob if the index-file exists, but it's usually good idea to add a trailing space handler to auto-fill urls like /docs
-> /docs/
-> /docs/index.html
. see https://cljdoc.org/d/metosin/reitit/0.3.10/doc/ring/slash-handler
@marciogiaxa so the pedestal swagger example fails?
thanks @ikitommi. so assuming that /resources/public/index.html
exists and i visit
, i shouldn't be "redirected" to
?
(def app
(ring/ring-handler
(ring/router
[api-routes/routes]
{
:conflicts (constantly nil)
:data {:muuntaja m/instance
:coercion reitit.coercion.spec/coercion
:middleware [params/wrap-params
muuntaja/format-middleware
coercion/coerce-exceptions-middleware
coercion/coerce-request-middleware
coercion/coerce-response-middleware
[wrap-cors identity]]}})
(ring/routes
(ring/create-resource-handler {:path "/"})
(ring/create-default-handler))))
it seems that even with the example in the docs verbatim, i end up with index.html in the url (using reitit v3.10.0)
(ring/ring-handler
(ring/router
["/ping" (constantly {:status 200, :body "pong"})])
(ring/routes
(ring/create-resource-handler {:path "/"})
(ring/create-default-handler)))