Add Patchdata function

This commit is contained in:
Beu 2024-05-27 14:06:59 +02:00
parent a8ad7492cf
commit 268e7454a9

View File

@ -109,6 +109,34 @@ class AsyncHttpRequest implements UsageInformationAble {
$this->processRequest($request); $this->processRequest($request);
} }
/**
* Carry out a PatchData Request
*/
public function patchData() {
array_push($this->headers, 'Content-Type: ' . $this->contentType);
array_push($this->headers, 'Keep-Alive: timeout=600, max=2000');
array_push($this->headers, 'Connection: Keep-Alive');
array_push($this->headers, 'Expect:');
array_push($this->headers, 'Accept-Charset: utf-8');
$content = $this->content;
if ($this->compression) {
$content = gzencode($this->content);
array_push($this->headers, 'Content-Encoding: gzip');
}
$request = $this->newRequest($this->url, $this->timeout);
$request->getOptions()->set(CURLOPT_CUSTOMREQUEST, 'PATCH')// patch method
->set(CURLOPT_POSTFIELDS, $content)// post content field
->set(CURLOPT_HTTPHEADER, $this->headers) // headers
;
$this->processRequest($request);
}
/** /**
* Processes the Request * Processes the Request
* *