Skip to content

Commit b42bca1

Browse files
committed
feat(http client): expose default request timeout constant to be used instead of magic number 30
Will be used to set default where we are able to override the default timeout. See #48418 Signed-off-by: Thomas Citharel <tcit@tcit.fr>
1 parent d537050 commit b42bca1

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/private/Http/Client/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ private function buildRequestOptions(array $options): array {
5353

5454
$defaults = [
5555
RequestOptions::VERIFY => $this->getCertBundle(),
56-
RequestOptions::TIMEOUT => 30,
56+
RequestOptions::TIMEOUT => IClient::DEFAULT_REQUEST_TIMEOUT,
5757
];
5858

5959
$options['nextcloud']['allow_local_address'] = $this->isLocalAddressAllowed($options);

lib/public/Http/Client/IClient.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@
1414
* @since 8.1.0
1515
*/
1616
interface IClient {
17+
18+
/**
19+
* Default request timeout for requests
20+
*
21+
* @since 31.0.0
22+
*/
23+
public const DEFAULT_REQUEST_TIMEOUT = 30;
24+
1725
/**
1826
* Sends a GET request
1927
* @param string $uri

0 commit comments

Comments
 (0)