Skip to content

Commit 0ac48ca

Browse files
authored
Merge pull request #5925 from patrick7/add-http-timeout
[7.x] Add undocumented timeout method for Http Client
2 parents d3b95b9 + e92f60a commit 0ac48ca

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

http-client.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- [Request Data](#request-data)
66
- [Headers](#headers)
77
- [Authentication](#authentication)
8+
- [Timeout](#timeout)
89
- [Retries](#retries)
910
- [Error Handling](#error-handling)
1011
- [Guzzle Options](#guzzle-options)
@@ -110,6 +111,15 @@ If you would like to quickly add an `Authorization` bearer token header to the r
110111

111112
$response = Http::withToken('token')->post(...);
112113

114+
<a name="timeout"></a>
115+
### Timeout
116+
117+
The `timeout` method may be used to specify the maximum number of seconds to wait for a response:
118+
119+
$response = Http::timeout(3)->get(...);
120+
121+
If the given timeout is exceeded, an instance of `Illuminate\Http\Client\ConnectionException` will be thrown.
122+
113123
<a name="retries"></a>
114124
### Retries
115125

0 commit comments

Comments
 (0)