mirror of
https://github.com/metosin/reitit.git
synced 2026-02-06 20:13:11 +00:00
Handle nil for lower-case
- when "_method" is actually empty, we need to avoid trying to do string manipulation on nil from params.
This commit is contained in:
parent
a3b251449b
commit
7fb720ef36
1 changed files with 4 additions and 4 deletions
|
|
@ -8,10 +8,10 @@ We can do this with middleware in reitit like this:
|
||||||
```clj
|
```clj
|
||||||
(defn- hidden-method
|
(defn- hidden-method
|
||||||
[request]
|
[request]
|
||||||
(keyword
|
(some-> (or (get-in request [:form-params "_method"]) ;; look for "_method" field in :form-params
|
||||||
(clojure.string/lower-case
|
(get-in request [:multipart-params "_method"])) ;; or in :multipart-params
|
||||||
(or (get-in request [:form-params "_method"]) ;; look for "_method" field in :form-params
|
clojure.string/lower-case
|
||||||
(get-in request [:multipart-params "_method"]))))) ;; or in :multipart-params
|
keyword))
|
||||||
|
|
||||||
(def wrap-hidden-method
|
(def wrap-hidden-method
|
||||||
{:name ::wrap-hidden-method
|
{:name ::wrap-hidden-method
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue