Skip to content

Commit

Permalink
feat(http client): expose default request timeout constant to be used…
Browse files Browse the repository at this point in the history
… 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>
  • Loading branch information
tcitworld committed Oct 10, 2024
1 parent d537050 commit b42bca1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/private/Http/Client/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private function buildRequestOptions(array $options): array {

$defaults = [
RequestOptions::VERIFY => $this->getCertBundle(),
RequestOptions::TIMEOUT => 30,
RequestOptions::TIMEOUT => IClient::DEFAULT_REQUEST_TIMEOUT,
];

$options['nextcloud']['allow_local_address'] = $this->isLocalAddressAllowed($options);
Expand Down
8 changes: 8 additions & 0 deletions lib/public/Http/Client/IClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
* @since 8.1.0
*/
interface IClient {

/**
* Default request timeout for requests
*
* @since 31.0.0
*/
public const DEFAULT_REQUEST_TIMEOUT = 30;

/**
* Sends a GET request
* @param string $uri
Expand Down

0 comments on commit b42bca1

Please sign in to comment.