Skip to content

Commit c8cdd5f

Browse files
committed
Clean up encode-body.
1 parent 44cd65f commit c8cdd5f

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/clojure/http/client.clj

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,13 @@ representation of text."
1515
[text]
1616
(URLEncoder/encode text "UTF-8"))
1717

18-
(defn- encode-body-map
19-
"Turns a map into a URL-encoded string suitable for a request body."
18+
(defn- encode-body
19+
"Turns a map into a URL-encoded string suitable for a request body,
20+
or just send it verbatim if it's a string."
2021
[body]
21-
(str-join "&" (map #(str-join "=" (map url-encode %)) body)))
22-
23-
(defn- encode-body [body]
2422
(if (string? body)
2523
body
26-
(encode-body-map body)))
24+
(str-join "&" (map #(str-join "=" (map url-encode %)) body))))
2725

2826
(defn url
2927
"If u is an instance of java.net.URL then returns it without

0 commit comments

Comments
 (0)