Skip to content

Commit 348ef97

Browse files
PandaLIU-1111limingxinleo
authored andcommitted
Added PUT and DELETE for Hyperf\Testing\Client. (#778)
1 parent faa9288 commit 348ef97

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/Client.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,26 @@ public function post($uri, $data = [], $headers = [])
7676
return $this->packer->unpack($response->getBody()->getContents());
7777
}
7878

79+
public function put($uri, $data = [], $headers = [])
80+
{
81+
$response = $this->request('PUT', $uri, [
82+
'headers' => $headers,
83+
'form_params' => $data,
84+
]);
85+
86+
return $this->packer->unpack($response->getBody()->getContents());
87+
}
88+
89+
public function delete($uri, $data = [], $headers = [])
90+
{
91+
$response = $this->request('DELETE', $uri, [
92+
'headers' => $headers,
93+
'query' => $data,
94+
]);
95+
96+
return $this->packer->unpack($response->getBody()->getContents());
97+
}
98+
7999
public function json($uri, $data = [], $headers = [])
80100
{
81101
$headers['Content-Type'] = 'application/json';

0 commit comments

Comments
 (0)