Returns the HTTP response body as a string, using the given
encoding.
If no encoding is given, uses the encoding specified in the server
headers, or clojure.contrib.io/*default-encoding* if it is
not specified.
(defn string
"Returns the HTTP response body as a string, using the given
encoding.
If no encoding is given, uses the encoding specified in the server
headers, or clojure.contrib.io/*default-encoding* if it is
not specified."
([http-agnt]
(await http-agnt) ;; have to wait for Content-Encoding
(string http-agnt (or (.getContentEncoding
^HttpURLConnection (::connection @http-agnt))
duck/*default-encoding*)))
([http-agnt ^String encoding]
(.toString (get-byte-buffer http-agnt) encoding)))
Comments top
No comments for string. Log in to add a comment.