diff --git a/project.clj b/project.clj index 7630cfa2..d1173132 100644 --- a/project.clj +++ b/project.clj @@ -1,7 +1,6 @@ (defproject org.martinklepsch/clj-http-lite "0.4.3" :description "A Clojure HTTP library similar to clj-http, but more lightweight." :url "https://github.com/martinklepsch/clj-http-lite/" - :warn-on-reflection false :license {:name "MIT" :url "http://www.opensource.org/licenses/mit-license.php"} :dependencies [[org.clojure/clojure "1.8.0"] diff --git a/src/clj_http/lite/client.clj b/src/clj_http/lite/client.clj index 2878e4c6..f0aeda8d 100644 --- a/src/clj_http/lite/client.clj +++ b/src/clj_http/lite/client.clj @@ -10,6 +10,8 @@ (java.net URL UnknownHostException)) (:refer-clojure :exclude (get update))) +(set! *warn-on-reflection* true) + (defn update [m k f & args] (assoc m k (apply f (m k) args))) diff --git a/src/clj_http/lite/core.clj b/src/clj_http/lite/core.clj index 246d1d2f..5bdc6b05 100644 --- a/src/clj_http/lite/core.clj +++ b/src/clj_http/lite/core.clj @@ -4,6 +4,8 @@ (:import (java.io ByteArrayOutputStream InputStream IOException) (java.net URI URL HttpURLConnection))) +(set! *warn-on-reflection* true) + (defn parse-headers "Takes a URLConnection and returns a map of names to values. @@ -53,7 +55,7 @@ (when server-port (str ":" server-port)) uri (when query-string (str "?" query-string))) - conn (.openConnection ^URL (URL. http-url))] + ^HttpURLConnection conn (.openConnection ^URL (URL. http-url))] (when (and content-type character-encoding) (.setRequestProperty conn "Content-Type" (str content-type "; charset=" @@ -63,8 +65,8 @@ (doseq [[h v] headers] (.setRequestProperty conn h v)) (when (false? follow-redirects) - (.setInstanceFollowRedirects ^HttpURLConnection conn false)) - (.setRequestMethod ^HttpURLConnection conn (.toUpperCase (name request-method))) + (.setInstanceFollowRedirects conn false)) + (.setRequestMethod conn (.toUpperCase (name request-method))) (when body (.setDoOutput conn true)) (when socket-timeout @@ -78,7 +80,7 @@ (with-open [out (.getOutputStream conn)] (io/copy body out))) (merge {:headers (parse-headers conn) - :status (.getResponseCode ^HttpURLConnection conn) + :status (.getResponseCode conn) :body (when-not (= request-method :head) (coerce-body-entity req conn))} (when save-request? diff --git a/src/clj_http/lite/links.clj b/src/clj_http/lite/links.clj index 87f9a807..3456439d 100644 --- a/src/clj_http/lite/links.clj +++ b/src/clj_http/lite/links.clj @@ -3,6 +3,8 @@ Imported from https://github.com/dakrone/clj-http/blob/217393258e7863514debece4eb7b23a7a3fa8bd9/src/clj_http/links.clj") +(set! *warn-on-reflection* true) + (def ^:private quoted-string #"\"((?:[^\"]|\\\")*)\"") diff --git a/src/clj_http/lite/util.clj b/src/clj_http/lite/util.clj index c05eedc8..32b65232 100644 --- a/src/clj_http/lite/util.clj +++ b/src/clj_http/lite/util.clj @@ -6,6 +6,8 @@ (java.util.zip InflaterInputStream DeflaterInputStream GZIPInputStream GZIPOutputStream))) +(set! *warn-on-reflection* true) + (defn utf8-bytes "Returns the UTF-8 bytes corresponding to the given string." [#^String s]