mirror of
https://github.com/metosin/reitit.git
synced 2025-12-17 08:21:11 +00:00
Polish code
This commit is contained in:
parent
01730778e5
commit
b4835a7860
2 changed files with 5 additions and 6 deletions
|
|
@ -64,7 +64,7 @@ With provided path-parameters:
|
|||
; :path-params {:id "1"}}
|
||||
```
|
||||
|
||||
Path-parameters are automatically coerced into strings, with the help of (currently internal) Protocol `reitit.impl/IntoString`. It supports numbers, booleans, keywords and objects:
|
||||
Path-parameters are automatically coerced into strings, with the help of (currently internal) Protocol `reitit.impl/IntoString`. It supports strings, numbers, booleans, keywords and objects:
|
||||
|
||||
```clj
|
||||
(r/match-by-name router ::user {:id 1})
|
||||
|
|
|
|||
|
|
@ -169,8 +169,8 @@
|
|||
(.replace "+" "%20")))
|
||||
|
||||
(defn url-decode [s]
|
||||
#?(:clj (some-> s (URLDecoder/decode "UTF-8"))
|
||||
:cljs (some-> s (js/decodeURIComponent))))
|
||||
(some-> s #?(:clj (URLDecoder/decode "UTF-8")
|
||||
:cljs (js/decodeURIComponent))))
|
||||
|
||||
(defprotocol IntoString
|
||||
(into-string [_]))
|
||||
|
|
@ -183,9 +183,8 @@
|
|||
#?(:clj clojure.lang.Keyword
|
||||
:cljs cljs.core.Keyword)
|
||||
(into-string [this]
|
||||
(str (namespace this)
|
||||
(when (namespace this) "/")
|
||||
(name this)))
|
||||
(let [ns (namespace this)]
|
||||
(str ns (if ns "/") (name this))))
|
||||
|
||||
#?(:clj Boolean
|
||||
:cljs boolean)
|
||||
|
|
|
|||
Loading…
Reference in a new issue