diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-03-01 14:55:54 +0100 |
---|---|---|
committer | Côme Chilliet <91878298+come-nc@users.noreply.github.com> | 2024-03-07 14:06:08 +0100 |
commit | 01d5af66beed08810861e8547fd6cd0cfee6a52a (patch) | |
tree | 700ecabf600b9a9d6a6da8a93f9526a1a33e5057 /lib/public/Http/Client | |
parent | e17424fa11e25828cce3756e9c076f08f9c45e01 (diff) | |
download | nextcloud-server-01d5af66beed08810861e8547fd6cd0cfee6a52a.tar.gz nextcloud-server-01d5af66beed08810861e8547fd6cd0cfee6a52a.zip |
feat(IClient): Add `request` function to do arbitrary HTTP requests
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'lib/public/Http/Client')
-rw-r--r-- | lib/public/Http/Client/IClient.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/public/Http/Client/IClient.php b/lib/public/Http/Client/IClient.php index 9268eb62920..7bb3c032ea0 100644 --- a/lib/public/Http/Client/IClient.php +++ b/lib/public/Http/Client/IClient.php @@ -218,6 +218,37 @@ interface IClient { public function getResponseFromThrowable(\Throwable $e): IResponse; /** + * Sends a HTTP request + * @param string $uri + * @param string $method The HTTP method to use + * @param array $options Array such as + * 'query' => [ + * 'field' => 'abc', + * 'other_field' => '123', + * 'file_name' => fopen('/path/to/file', 'r'), + * ], + * 'headers' => [ + * 'foo' => 'bar', + * ], + * 'cookies' => [ + * 'foo' => 'bar', + * ], + * 'allow_redirects' => [ + * 'max' => 10, // allow at most 10 redirects. + * 'strict' => true, // use "strict" RFC compliant redirects. + * 'referer' => true, // add a Referer header + * 'protocols' => ['https'] // only allow https URLs + * ], + * 'sink' => '/path/to/file', // save to a file or a stream + * 'verify' => true, // bool or string to CA file + * 'debug' => true, + * @return IResponse + * @throws \Exception If the request could not get completed + * @since 29.0.0 + */ + public function request(string $uri, string $method, array $options = []): IResponse; + + /** * Sends an asynchronous GET request * @param string $uri * @param array $options Array such as |