mirror of
https://github.com/metosin/reitit.git
synced 2025-12-24 02:48:25 +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
|
||||
(defn- hidden-method
|
||||
[request]
|
||||
(keyword
|
||||
(clojure.string/lower-case
|
||||
(or (get-in request [:form-params "_method"]) ;; look for "_method" field in :form-params
|
||||
(get-in request [:multipart-params "_method"]))))) ;; or in :multipart-params
|
||||
(some-> (or (get-in request [:form-params "_method"]) ;; look for "_method" field in :form-params
|
||||
(get-in request [:multipart-params "_method"])) ;; or in :multipart-params
|
||||
clojure.string/lower-case
|
||||
keyword))
|
||||
|
||||
(def wrap-hidden-method
|
||||
{:name ::wrap-hidden-method
|
||||
|
|
|
|||
Loading…
Reference in a new issue