Skip to content

Commit 36a2579

Browse files
authored
Added missing methods put() and patch() to testing HTTP client (#5453)
1 parent b4e9ed4 commit 36a2579

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

src/Client.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,16 @@ public function put(string $uri, array $data = [], array $headers = [])
8585

8686
return $this->packer->unpack((string) $response->getBody());
8787
}
88+
89+
public function patch(string $uri, array $data = [], array $headers = [])
90+
{
91+
$response = $this->request('PATCH', $uri, [
92+
'headers' => $headers,
93+
'form_params' => $data,
94+
]);
95+
96+
return $this->packer->unpack((string) $response->getBody());
97+
}
8898

8999
public function delete(string $uri, array $data = [], array $headers = [])
90100
{

src/HttpClient.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,26 @@ public function post(string|UriInterface $uri, array $data = [], array $headers
5858

5959
return $this->packer->unpack((string) $response->getBody());
6060
}
61+
62+
public function put(string|UriInterface $uri, array $data = [], array $headers = [])
63+
{
64+
$response = $this->client->put($uri, [
65+
'headers' => $headers,
66+
'form_params' => $data,
67+
]);
68+
69+
return $this->packer->unpack((string) $response->getBody());
70+
}
71+
72+
public function patch(string|UriInterface $uri, array $data = [], array $headers = [])
73+
{
74+
$response = $this->client->patch($uri, [
75+
'headers' => $headers,
76+
'form_params' => $data,
77+
]);
78+
79+
return $this->packer->unpack((string) $response->getBody());
80+
}
6181

6282
public function json(string|UriInterface $uri, array $data = [], array $headers = [])
6383
{

0 commit comments

Comments
 (0)