Clojure client: put docstrings in the right place in core.clj.

This commit is contained in:
Ian McEwen 2015-12-02 10:05:37 -07:00
parent a2025c286e
commit 4edeed6053
2 changed files with 8 additions and 4 deletions

View File

@ -169,15 +169,17 @@
(map (fn [[k v]] [k (normalize-param v)]))
(into {})))
(defn json-mime? [mime]
(defn json-mime?
"Check if the given MIME is a standard JSON MIME or :json."
[mime]
(if mime
(or (= :json mime)
(re-matches #"application/json(;.*)?" (name mime)))))
(defn json-preferred-mime [mimes]
(defn json-preferred-mime
"Choose a MIME from the given MIMEs with JSON preferred,
i.e. return JSON if included, otherwise return the first one."
[mimes]
(-> (filter json-mime? mimes)
first
(or (first mimes))))

View File

@ -169,15 +169,17 @@
(map (fn [[k v]] [k (normalize-param v)]))
(into {})))
(defn json-mime? [mime]
(defn json-mime?
"Check if the given MIME is a standard JSON MIME or :json."
[mime]
(if mime
(or (= :json mime)
(re-matches #"application/json(;.*)?" (name mime)))))
(defn json-preferred-mime [mimes]
(defn json-preferred-mime
"Choose a MIME from the given MIMEs with JSON preferred,
i.e. return JSON if included, otherwise return the first one."
[mimes]
(-> (filter json-mime? mimes)
first
(or (first mimes))))