This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-12-11
Channels
- # adventofcode (31)
- # announcements (6)
- # babashka (5)
- # beginners (93)
- # calva (15)
- # cider (20)
- # cljs-dev (16)
- # clojure (159)
- # clojure-berlin (1)
- # clojure-dev (5)
- # clojure-europe (9)
- # clojure-italy (9)
- # clojure-losangeles (2)
- # clojure-nl (26)
- # clojure-spec (7)
- # clojure-uk (33)
- # clojurescript (54)
- # clojutre (5)
- # cursive (20)
- # datomic (23)
- # emacs (19)
- # events (1)
- # expound (1)
- # figwheel-main (1)
- # fulcro (104)
- # hyperfiddle (1)
- # jobs (1)
- # luminus (10)
- # malli (59)
- # nrepl (1)
- # off-topic (11)
- # pathom (5)
- # planck (15)
- # reagent (13)
- # reitit (8)
- # rewrite-clj (10)
- # ring-swagger (3)
- # shadow-cljs (129)
- # tools-deps (46)
- # xtdb (14)
- # yada (1)
good intro to integrant: https://lambdaisland.com/blog/2019-12-11-advent-of-parens-11-integrant-in-practice
n00bie question - Is there an idiom for handling/using ring.util.http-response with the default exception middleware?
I have an existing handler that returns not-authorized!
but it gets wrapped:
Fail in create-person
Security - only admins can create a person.
expected: (ru-hp/unauthorized? response)
actual: (not
(ru-hp/unauthorized?
{:status 400,
:body
{:type "response",
:response
{:status 401,
:headers {},
:body
{:text "Missing required role",
:required #{:person.role/admin},
:roles nil}},
:message "HTTP 401"},
:headers nil}))
nm, read the source and figured out that I need to override the default :ring/response
handler.
👍 4
The solution I came up with was to replace exception/exception-middleware
with:
(exception/create-exception-middleware
(merge exception/default-handlers
{:ring-util.http-response/response (:reitit.ring/response exception/default-handlers)}))
@U08715BSS could be enabled by default. PR welcome!