Skip to content

Commit 92debce

Browse files
author
Leon Barrett
committed
Added comments that timeouts are in milliseconds.
1 parent fd25ff6 commit 92debce

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Readme.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ More example requests:
7575
:body "{\"json\": \"input\"}"
7676
:headers {"X-Api-Version" "2"}
7777
:content-type :json
78-
:socket-timeout 1000
79-
:conn-timeout 1000
78+
:socket-timeout 1000 ;; in milliseconds
79+
:conn-timeout 1000 ;; in milliseconds
8080
:accept :json})
8181

8282
;; Specifying headers as either a string or collection:
@@ -101,6 +101,10 @@ More example requests:
101101
;; Throw an exception if redirected too many times:
102102
(client/get "http://site.come/redirects-somewhere" {:max-redirects 5 :throw-exceptions true})
103103

104+
;; Throw an exception if the get takes too long. Timeouts in milliseconds.
105+
(client/get "http://site.come/redirects-somewhere" {:socket-timeout 1000 :conn-timeout 1000})
106+
107+
104108
;; Send form params as a urlencoded body (POST or PUT)
105109
(client/post "http//site.com" {:form-params {:foo "bar"}})
106110
;; Send form params as a json encoded body (POST or PUT)

src/clj_http/core.clj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@
171171
Note that where Ring uses InputStreams for the request and response bodies,
172172
the clj-http uses ByteArrays for the bodies."
173173
[{:keys [request-method scheme server-name server-port uri query-string
174-
headers body socket-timeout conn-timeout multipart debug debug-body
174+
headers body multipart debug debug-body
175+
socket-timeout conn-timeout ;; in milliseconds
175176
insecure? save-request? proxy-host proxy-port as cookie-store
176177
retry-handler response-interceptor digest-auth connection-manager
177178
client-params] :as req}]

0 commit comments

Comments
 (0)