From 29e9c721cf965ddad38ccad1910f694a9ed3446a Mon Sep 17 00:00:00 2001 From: Patrick Velder Date: Sat, 28 Mar 2020 14:06:27 +0100 Subject: [PATCH 1/2] Add undocumented timeout method for Http Client --- http-client.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/http-client.md b/http-client.md index d4afd8ccd11..1f12be61b55 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 + +To set a timeout for your request, you can use the `timeout` method. + + $response = Http::timeout(3)->get(...); + +If the timeout is exceeded, an instance of `Illuminate\Http\Client\ConnectionException` will be thrown. + ### Retries From e92f60ab17c7e61c9207217e87afd493b7e94d9f Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Sun, 29 Mar 2020 10:17:34 -0500 Subject: [PATCH 2/2] Update http-client.md --- http-client.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/http-client.md b/http-client.md index 1f12be61b55..c5045009583 100644 --- a/http-client.md +++ b/http-client.md @@ -114,11 +114,11 @@ If you would like to quickly add an `Authorization` bearer token header to the r ### Timeout -To set a timeout for your request, you can use the `timeout` method. +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 timeout is exceeded, an instance of `Illuminate\Http\Client\ConnectionException` will be thrown. +If the given timeout is exceeded, an instance of `Illuminate\Http\Client\ConnectionException` will be thrown. ### Retries