This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-06-13
Channels
- # beginners (78)
- # boot (27)
- # cider (13)
- # cljs-dev (41)
- # cljsrn (4)
- # clojure (216)
- # clojure-android (1)
- # clojure-conj (6)
- # clojure-greece (1)
- # clojure-italy (11)
- # clojure-russia (127)
- # clojure-spec (63)
- # clojure-uk (34)
- # clojurescript (68)
- # core-async (5)
- # cursive (5)
- # data-science (1)
- # datomic (4)
- # dirac (11)
- # editors (7)
- # events (1)
- # graphql (12)
- # hoplon (39)
- # jobs (1)
- # liberator (3)
- # lumo (101)
- # off-topic (14)
- # om (3)
- # onyx (3)
- # parinfer (14)
- # re-frame (10)
- # reagent (2)
- # remote-jobs (1)
- # ring-swagger (17)
- # sql (21)
- # untangled (38)
- # vim (3)
- # yada (23)
which of all the yada interceptors is the one that actually invokes the :response
function ?
yada.interceptors/invoke-method
indirectly - the method proxies are called, and a method proxy will call the response function (depending on the semantics of the method)
e.g. the HEAD method will not even call the response function, nor will OPTIONS
the method proxy also determines how the return value of the response function is interpretted
it appears as if my interceptor is not invoked when my :response
fn returns nil, is that expected behaviour ?
Can you post an example
let me first try to figure out what's going wrong then, might be that i'm at fault here
Any hints on how to set a custom http header on the response ?
I think you can add it into the context response.
eg:
["/test" (yada/handler
(yada/resource
{:methods {:get {:produces "plain/text"
:response (fn [ctx]
(-> ctx
:response
(assoc :status 200 :body "Hello\n")
(assoc-in [:headers "X-Custom"] "Neurodiversity")))}}}))]
@malcolmsparks i think i know what's going on -- a nil/404 raises an exception, which causes the error-interceptor-chain to be continued, rather than the regular interceptor-chain
@zamaterian see status responses
Is it possible to get access to the ctx from the normal interceptor chain after an error has happened, e.g. get the parsed request body out of it?