This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-09-01
Channels
- # adventofcode (2)
- # announcements (3)
- # babashka-sci-dev (79)
- # beginners (76)
- # biff (2)
- # calva (32)
- # cider (2)
- # clj-kondo (42)
- # clj-on-windows (17)
- # clojure (28)
- # clojure-belgium (1)
- # clojure-berlin (1)
- # clojure-europe (95)
- # clojure-nl (4)
- # clojure-norway (4)
- # clojure-uk (5)
- # clojurescript (27)
- # conjure (5)
- # cursive (3)
- # data-science (16)
- # datomic (67)
- # graalvm (12)
- # hyperfiddle (36)
- # jobs (3)
- # jobs-discuss (1)
- # kaocha (2)
- # klipse (1)
- # leiningen (28)
- # lsp (16)
- # luminus (3)
- # malli (10)
- # nrepl (3)
- # off-topic (57)
- # other-languages (18)
- # re-frame (4)
- # reitit (8)
- # releases (1)
- # remote-jobs (1)
- # scittle (4)
- # shadow-cljs (7)
- # test-check (1)
- # tools-deps (4)
- # vim (11)
- # xtdb (25)
how do I return custom json 404 response from my handler function? I am using reitit swagger support, and I wrote my custom 404 function like this:
(defn not-found
"This function returns 404 Not Found response"
[message]
{:status 404
:body {:message message}})
but when I try to call this I get this error:
{
"spec": "(spec-tools.core/spec {:spec (clojure.spec.alpha/keys :req-un [:spec$21241/status :spec$21241/message]), :type :map, :leaf? false})",
"problems": [
{
"path": [],
"pred": "(clojure.core/fn [%] (clojure.core/contains? % :status))",
"val": {
"message": "Not found"
},
"via": [],
"in": []
}
],
"type": "reitit.coercion/response-coercion",
"coercion": "spec",
"value": {
"message": "Not found"
},
"in": [
"response",
"body"
]
}