Skip to content
Permalink
Browse files

fix 17: java 9 & 20 compatibility

  • Loading branch information
martinklepsch committed Jul 23, 2018
1 parent c0a4645 commit 3f41fc53a1b692549c88a8602e753cfb887330ae
Showing with 7 additions and 2 deletions.
  1. +7 −2 src/clj_http/lite/util.clj
@@ -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."

0 comments on commit 3f41fc5

Please sign in to comment.
You can’t perform that action at this time.