Skip to content

Commit 73b1262

Browse files
authored
Use clj-commons.slingshot (#659)
Sadly, the maintainer of the original slingshot has passed away. The slingshot library has been adopted into the clj-commons repository and will be maintained under a different set of coordinates going forward. fixes #658 -=david=-
1 parent cfcc70e commit 73b1262

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

.github/workflows/clojure.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
java: ["14", "17", "21"]
15-
clojure: ["1.8", "1.9", "1.10", "1.11"]
14+
java: ["14", "17", "21", "25"]
15+
clojure: ["1.8", "1.9", "1.10", "1.11", "1.12"]
1616

1717
name: Java ${{ matrix.java }} Clojure ${{ matrix.clojure }}
1818
steps:
19-
- uses: actions/checkout@v2
20-
- uses: actions/cache@v2
19+
- uses: actions/checkout@v6
20+
- uses: actions/cache@v4
2121
with:
2222
path: ~/.m2/repository
2323
key: ${{ runner.os }}-lein-${{ hashFiles('**/project.clj') }}
2424
restore-keys: |
2525
${{ runner.os }}-lein-
2626
2727
- name: Setup java
28-
uses: actions/setup-java@v1
28+
uses: actions/setup-java@v5
2929
with:
3030
java-version: ${{ matrix.java }}
3131

README.org

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,7 @@ files or =KeyStore= instances.
852852

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

858858
#+BEGIN_SRC clojure

project.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
[org.apache.httpcomponents/httpclient-cache "4.5.14"]
1212
[org.apache.httpcomponents/httpasyncclient "4.1.5"]
1313
[org.apache.httpcomponents/httpmime "4.5.14"]
14+
[org.clj-commons/slingshot "0.13.0"]
1415
[commons-codec "1.16.1"]
1516
[commons-io "2.16.1"]
16-
[slingshot "0.12.2"]
1717
[potemkin "0.4.7"]]
1818
:resource-paths ["resources"]
1919
:profiles {:dev {:dependencies [;; optional deps

src/clj_http/client.clj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
(ns clj-http.client
22
"Batteries-included HTTP client."
33
(:refer-clojure :exclude [get update])
4-
(:require [clj-http.conn-mgr :as conn]
4+
(:require [clj-commons.slingshot :refer [throw+]]
5+
[clj-http.conn-mgr :as conn]
56
[clj-http.cookies :refer [wrap-cookies]]
67
[clj-http.core :as core]
78
[clj-http.headers :refer [wrap-header-map]]
@@ -11,9 +12,8 @@
1112
[clojure.stacktrace :refer [root-cause]]
1213
[clojure.string :as str]
1314
[clojure.walk :refer [keywordize-keys prewalk]]
14-
[clojure.xml :as xml]
15-
[slingshot.slingshot :refer [throw+]])
16-
(:import [java.io BufferedReader ByteArrayInputStream ByteArrayOutputStream EOFException File InputStream]
15+
[clojure.xml :as xml])
16+
(:import [java.io BufferedReader ByteArrayOutputStream EOFException File InputStream]
1717
[java.net UnknownHostException URL]
1818
[org.apache.http.entity BufferedHttpEntity ByteArrayEntity FileEntity InputStreamEntity StringEntity]
1919
[javax.xml.parsers SAXParser SAXParserFactory]
@@ -479,8 +479,8 @@
479479
(..
480480
(doto
481481
(SAXParserFactory/newInstance)
482-
(.setFeature
483-
"http://apache.org/xml/features/nonvalidating/load-external-dtd" false))
482+
(.setFeature
483+
"http://apache.org/xml/features/nonvalidating/load-external-dtd" false))
484484
(newSAXParser)))
485485

486486
(defn- non-validating [s ^DefaultHandler ch]

test/clj_http/test/client_test.clj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
(ns clj-http.test.client-test
22
(:require [cheshire.core :as json]
3+
[clj-commons.slingshot :refer [try+]]
34
[clj-http.client :as client]
45
[clj-http.conn-mgr :as conn]
56
[clj-http.test.core-test :refer [run-server]]
67
[clj-http.util :as util]
78
[clojure.java.io :as io :refer [resource]]
89
[clojure.string :as str]
9-
[clojure.test :refer :all]
10+
[clojure.test :refer [deftest is testing]]
1011
[cognitect.transit :as transit]
1112
[ring.middleware.nested-params :refer [parse-nested-keys]]
12-
[ring.util.codec :refer [form-decode-str]]
13-
[slingshot.slingshot :refer [try+]])
13+
[ring.util.codec :refer [form-decode-str]])
1414
(:import java.io.ByteArrayInputStream
1515
java.io.PipedInputStream
1616
java.io.PipedOutputStream
@@ -507,7 +507,7 @@
507507
(doseq [method [:put :post :delete]
508508
status [301 302 307 308]]
509509
(let [client (fn [req] {:status status :body (:body req)
510-
:headers {"location" "http://example.com/bat"}})
510+
:headers {"location" "http://example.com/bat"}})
511511
r-client (client/wrap-redirects client)
512512
resp (r-client {:body "ok" :url "http://example.com"
513513
:request-method method})]
@@ -1380,7 +1380,7 @@
13801380
(fn [req] {:body nil})) {:decode-body-headers true})
13811381
resp4 ((client/wrap-additional-header-parsing
13821382
(fn [req] {:headers {"content-type" "application/pdf"}
1383-
:body (.getBytes text)}))
1383+
:body (.getBytes text)}))
13841384
{:decode-body-headers true})]
13851385
(is (= {"content-type" "text/html; charset=Shift_JIS"
13861386
"content-style-type" "text/css"

0 commit comments

Comments
 (0)