This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-08-13
Channels
- # babashka (10)
- # beginners (27)
- # calva (91)
- # cestmeetup (3)
- # cider (27)
- # clj-kondo (12)
- # cljs-dev (4)
- # clojars (13)
- # clojure (35)
- # clojure-europe (30)
- # clojure-france (3)
- # clojure-houston (1)
- # clojure-nl (11)
- # clojure-norway (29)
- # clojure-spec (23)
- # clojure-sweden (5)
- # clojure-uk (128)
- # clojurescript (69)
- # conjure (44)
- # core-async (27)
- # cursive (13)
- # emacs (9)
- # events (3)
- # fulcro (52)
- # graphql (4)
- # jobs (2)
- # jobs-discuss (46)
- # kaocha (4)
- # luminus (12)
- # nrepl (10)
- # off-topic (29)
- # re-frame (17)
- # reitit (20)
- # remote-jobs (4)
- # rewrite-clj (1)
- # ring (4)
- # rum (13)
- # shadow-cljs (40)
- # sql (1)
- # xtdb (1)
Is there a way in lacinia-pedestal
to set the HTTP status code of a request? My API requires authentication and error handling on the client side would be a lot easier if one could also signal errors on the HTTP protocol level.
Slight pushback: Although authorization is probably okay to do with status codes (we do so too), its often encouraged in GraphQL to return 200 + error messages, or 200 + some kind of schema error.
For example: https://medium.com/@sachee/200-ok-error-handling-in-graphql-7ec869aec9bc
Sorry, for asking too soon, the answer is here: https://lacinia-pedestal.readthedocs.io/en/latest/response.html Just like that:
(resolve/resolve-as nil {:message "Access denied."
:status 403})
👍 6