diff --git a/http-client.md b/http-client.md index d4afd8ccd11..c5045009583 100644 --- a/http-client.md +++ b/http-client.md @@ -5,6 +5,7 @@ - [Request Data](#request-data) - [Headers](#headers) - [Authentication](#authentication) + - [Timeout](#timeout) - [Retries](#retries) - [Error Handling](#error-handling) - [Guzzle Options](#guzzle-options) @@ -110,6 +111,15 @@ If you would like to quickly add an `Authorization` bearer token header to the r $response = Http::withToken('token')->post(...); + +### Timeout + +The `timeout` method may be used to specify the maximum number of seconds to wait for a response: + + $response = Http::timeout(3)->get(...); + +If the given timeout is exceeded, an instance of `Illuminate\Http\Client\ConnectionException` will be thrown. + ### Retries