aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Http/Client
diff options
context:
space:
mode:
authorjithin-space <jithin.thankachan@gpsrenewables.com>2024-02-08 15:50:16 +0530
committerjithin-space <jithin.thankachan@gpsrenewables.com>2024-02-08 15:54:20 +0530
commit7c11414c9b3ea1b608bcf88381b237a90af348bd (patch)
treedeef0fd2798d012b607cc14a83cc8266586cf8c1 /lib/private/Http/Client
parent9e9040196f94e9650ce847e9feb9f23ad8d19ada (diff)
downloadnextcloud-server-7c11414c9b3ea1b608bcf88381b237a90af348bd.tar.gz
nextcloud-server-7c11414c9b3ea1b608bcf88381b237a90af348bd.zip
added patch method
Signed-off-by: jithin-space <jithin.thankachan@gpsrenewables.com>
Diffstat (limited to 'lib/private/Http/Client')
-rw-r--r--lib/private/Http/Client/Client.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/private/Http/Client/Client.php b/lib/private/Http/Client/Client.php
index 3bf43e6c07e..4bc276af9aa 100644
--- a/lib/private/Http/Client/Client.php
+++ b/lib/private/Http/Client/Client.php
@@ -339,6 +339,41 @@ class Client implements IClient {
}
/**
+ * Sends a PATCH request
+ *
+ * @param string $uri
+ * @param array $options Array such as
+ * 'body' => [
+ * '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,
+ * 'timeout' => 5,
+ * @return IResponse
+ * @throws \Exception If the request could not get completed
+ */
+ public function patch(string $uri, array $options = []): IResponse {
+ $this->preventLocalAddress($uri, $options);
+ $response = $this->client->request('patch', $uri, $this->buildRequestOptions($options));
+ return new Response($response);
+ }
+
+ /**
* Sends a DELETE request
*
* @param string $uri