This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-04-11
Channels
- # announcements (3)
- # asami (4)
- # babashka (79)
- # babashka-sci-dev (47)
- # beginners (97)
- # biff (12)
- # calva (7)
- # clj-commons (3)
- # clj-kondo (22)
- # clj-on-windows (13)
- # cljdoc (31)
- # cljfx (2)
- # cljs-dev (1)
- # clojure (85)
- # clojure-austin (4)
- # clojure-dev (12)
- # clojure-europe (15)
- # clojure-italy (8)
- # clojure-nl (4)
- # clojure-uk (4)
- # community-development (19)
- # conjure (3)
- # core-typed (40)
- # cursive (9)
- # datahike (21)
- # datomic (1)
- # emacs (7)
- # exercism (2)
- # graalvm (20)
- # graphql (1)
- # honeysql (16)
- # jobs (1)
- # malli (2)
- # off-topic (3)
- # pathom (28)
- # pedestal (3)
- # polylith (7)
- # reitit (14)
- # releases (1)
- # remote-jobs (1)
- # rewrite-clj (4)
- # shadow-cljs (21)
- # sql (21)
- # testing (8)
- # tools-deps (23)
- # vscode (8)
- # xtdb (38)
https://cljdoc.org/d/metosin/reitit/0.5.18/doc/ring/ring-router#reititringring-handler has the match being placed in the request under :reitit.core/match
.
however, there's no indication of which handler is being called - :get
, :post
, etc. - in the match data that is put there.
does this mean that i'm expected to inspect the request's :request-method
myself, or is it perhaps an oversight that the match doesn't include this info?
The impl uses request-method. The route match happens first without considering request-method, then the reitit ring adapter checks if the match has a handler fn for that method. https://github.com/metosin/reitit/blob/master/modules/reitit-ring/src/reitit/ring.cljc#L324-L327
ok great, so basically this injection of the match happens before the request-method stuff is dealt with, cool
thanks for the quick response!
I think the injection still happens after this (the next line), but the match data was constructed without considering the method. There isn't a reason why method couldn't be added to match, but I guess it just wasn't considered as the reitit-core version doesn't know anything about method anyway.
Hi. This PUT request throws a null pointer exception, and I can't figure out why?
:put {:tags ["Data set"]
:summary "Update data set"
:parameters {:path :econdata.utilities.spec/datasets-path-params
:multipart {:file multipart/temp-file-part}}
:handler (constantly {:status 200})}
Changing the method to a POST request returns status 200 OK
I am using the latest Reitit
I don’t know off the top of my head, but some questions I would ask myself are: (1) what middleware is being used? (2) what are the different ways that POST and PUT are handled by reitit and/or the middleware, for example, is there an expectation of a :body
that is not being supplied, producing the null pointer exception? Those are some things I would check. Good luck!
Thanks I will definitely try your advice
You were spot on, it was a custom middleware I had written that was misbehaving. Thanks for the help. A false clue led me to waste hours on what should have been a simple fix T_T