Skip to content
This repository has been archived by the owner on Jul 24, 2018. It is now read-only.

Java 9 & 10 support #18

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions deps.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{:paths ["src"]
:deps {org.clojure/clojure {:mvn/version "1.6.0"}
slingshot {:mvn/version "0.12.1"}}}
9 changes: 7 additions & 2 deletions src/clj_http/lite/util.clj
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,15 @@
[unencoded]
(URLEncoder/encode unencoded "UTF-8"))

(defn base64-encode
(defmacro base64-encode
"Encode an array of bytes into a base64 encoded string."
[unencoded]
(javax.xml.bind.DatatypeConverter/printBase64Binary unencoded))
(if (try (import 'javax.xml.bind.DatatypeConverter)
(catch ClassNotFoundException _))
`(javax.xml.bind.DatatypeConverter/printBase64Binary ~unencoded)
(do
(import 'java.util.Base64)
`(.encodeToString (java.util.Base64/getEncoder) ~unencoded))))

(defn to-byte-array
"Returns a byte array for the InputStream provided."
Expand Down