aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/Http
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public/Http')
-rw-r--r--lib/public/Http/Client/IClient.php41
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/public/Http/Client/IClient.php b/lib/public/Http/Client/IClient.php
index e3135fc7aff..9661a9e3829 100644
--- a/lib/public/Http/Client/IClient.php
+++ b/lib/public/Http/Client/IClient.php
@@ -238,6 +238,47 @@ interface IClient {
public function options(string $uri, array $options = []): IResponse;
/**
+ * Get the response of a Throwable thrown by the request methods when possible
+ *
+ * @param \Throwable $e
+ * @return IResponse
+ * @throws \Throwable When $e did not have a response
+ * @since 29.0.0
+ */
+ public function getResponseFromThrowable(\Throwable $e): IResponse;
+
+ /**
+ * Sends a HTTP request
+ * @param string $method The HTTP method to use
+ * @param string $uri
+ * @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 $method, string $uri, array $options = []): IResponse;
+
+ /**
* Sends an asynchronous GET request
* @param string $uri
* @param array $options Array such as