Skip to content
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
2 changes: 1 addition & 1 deletion README.org
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ files or =KeyStore= instances.

The client will throw exceptions on, well, exceptional status codes, meaning all
HTTP responses other than =#{200 201 202 203 204 205 206 207 300 301 302 303 304
307}=. clj-http will throw a [[http://github.com/scgilardi/slingshot][Slingshot]] Stone that can be caught by a regular
307}=. clj-http will throw a [[http://github.com/clj-commons/slingshot][Slingshot]] Stone that can be caught by a regular
=(catch Exception e ...)= or in Slingshot's =try+= block:

#+BEGIN_SRC clojure
Expand Down
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
[org.apache.httpcomponents/httpclient-cache "4.5.14"]
[org.apache.httpcomponents/httpasyncclient "4.1.5"]
[org.apache.httpcomponents/httpmime "4.5.14"]
[org.clj-commons/slingshot "0.13.0"]
[commons-codec "1.16.1"]
[commons-io "2.16.1"]
[slingshot "0.12.2"]
[potemkin "0.4.7"]]
:resource-paths ["resources"]
:profiles {:dev {:dependencies [;; optional deps
Expand Down
12 changes: 6 additions & 6 deletions src/clj_http/client.clj
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
(ns clj-http.client
"Batteries-included HTTP client."
(:refer-clojure :exclude [get update])
(:require [clj-http.conn-mgr :as conn]
(:require [clj-commons.slingshot :refer [throw+]]
[clj-http.conn-mgr :as conn]
[clj-http.cookies :refer [wrap-cookies]]
[clj-http.core :as core]
[clj-http.headers :refer [wrap-header-map]]
Expand All @@ -11,9 +12,8 @@
[clojure.stacktrace :refer [root-cause]]
[clojure.string :as str]
[clojure.walk :refer [keywordize-keys prewalk]]
[clojure.xml :as xml]
[slingshot.slingshot :refer [throw+]])
(:import [java.io BufferedReader ByteArrayInputStream ByteArrayOutputStream EOFException File InputStream]
[clojure.xml :as xml])
(:import [java.io BufferedReader ByteArrayOutputStream EOFException File InputStream]
[java.net UnknownHostException URL]
[org.apache.http.entity BufferedHttpEntity ByteArrayEntity FileEntity InputStreamEntity StringEntity]
[javax.xml.parsers SAXParser SAXParserFactory]
Expand Down Expand Up @@ -479,8 +479,8 @@
(..
(doto
(SAXParserFactory/newInstance)
(.setFeature
"http://apache.org/xml/features/nonvalidating/load-external-dtd" false))
(.setFeature
"http://apache.org/xml/features/nonvalidating/load-external-dtd" false))
(newSAXParser)))

(defn- non-validating [s ^DefaultHandler ch]
Expand Down
10 changes: 5 additions & 5 deletions test/clj_http/test/client_test.clj
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
(ns clj-http.test.client-test
(:require [cheshire.core :as json]
[clj-commons.slingshot :refer [try+]]
[clj-http.client :as client]
[clj-http.conn-mgr :as conn]
[clj-http.test.core-test :refer [run-server]]
[clj-http.util :as util]
[clojure.java.io :as io :refer [resource]]
[clojure.string :as str]
[clojure.test :refer :all]
[clojure.test :refer [deftest is testing]]
[cognitect.transit :as transit]
[ring.middleware.nested-params :refer [parse-nested-keys]]
[ring.util.codec :refer [form-decode-str]]
[slingshot.slingshot :refer [try+]])
[ring.util.codec :refer [form-decode-str]])
(:import java.io.ByteArrayInputStream
java.io.PipedInputStream
java.io.PipedOutputStream
Expand Down Expand Up @@ -507,7 +507,7 @@
(doseq [method [:put :post :delete]
status [301 302 307 308]]
(let [client (fn [req] {:status status :body (:body req)
:headers {"location" "http://example.com/bat"}})
:headers {"location" "http://example.com/bat"}})
r-client (client/wrap-redirects client)
resp (r-client {:body "ok" :url "http://example.com"
:request-method method})]
Expand Down Expand Up @@ -1380,7 +1380,7 @@
(fn [req] {:body nil})) {:decode-body-headers true})
resp4 ((client/wrap-additional-header-parsing
(fn [req] {:headers {"content-type" "application/pdf"}
:body (.getBytes text)}))
:body (.getBytes text)}))
{:decode-body-headers true})]
(is (= {"content-type" "text/html; charset=Shift_JIS"
"content-style-type" "text/css"
Expand Down