ring-codec icon indicating copy to clipboard operation
ring-codec copied to clipboard

Consider dropping commons-codec lib in favor of java.util.Base64

Open borkdude opened this issue 4 years ago • 1 comments

The java.util.Base64 class comes with Java 8. Java 7 is no longer publicly supported. I think it would be safe to replace the commons-codec dependency with pure Java: this library only uses it for base64 encoding/decoding.

This has an additional benefit: this library will become compatible with babashka:

(require '[babashka.deps :as deps]
         '[org.httpkit.server :as server])

(deps/add-deps '{:deps {ring/ring {:mvn/version "1.9.0"}
                        ring/ring-codec {:git/url "https://github.com/borkdude/ring-codec"
                                         :sha "5142b1334e1a8a2e5b1a88759b0746c77e33a0b8"
                                         :deps/manifest :deps}}})

(require '[ring.middleware.params :as p])

(server/run-server (p/wrap-params
                    (fn [req]
                      {:body (:query-params req)}))
                   {:port 8090})

@(promise)
http://localhost:8090/?q=1&q=2
;; =>
["q" ["1" "2"]]

I have already applied this change at a fork here: https://github.com/borkdude/ring-codec and all the tests are passing.

Let me know if you want to receive a PR.

borkdude avatar Mar 03 '21 20:03 borkdude

This seems reasonable. I'd happily accept a PR.

weavejester avatar Mar 04 '21 07:03 weavejester

https://github.com/ring-clojure/ring-codec/pull/27 is merged. Should this issue be closed?

devurandom avatar Apr 28 '23 17:04 devurandom

Thanks for pinging me @devurandom

borkdude avatar Apr 28 '23 17:04 borkdude