Skip to content

Commit

Permalink
Merge pull request #31 from gaobinzhan/master
Browse files Browse the repository at this point in the history
set path
  • Loading branch information
kiss291323003 authored Aug 11, 2020
2 parents 0a9f7f1 + 4348f1d commit 4cb2e3d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Handler/AbstractClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function setQuery(?array $data)
}
}

public function setPath(string $path)
public function setPath(?string $path = null)
{
// 请求时当前对象没有设置Url
if (!($this->url instanceof Url)) {
Expand Down
2 changes: 1 addition & 1 deletion src/HttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function setUrl($url): HttpClient
return $this;
}

public function setPath(string $path): HttpClient
public function setPath(?string $path = null): HttpClient
{
$this->clientHandler->setPath($path);
return $this;
Expand Down
5 changes: 5 additions & 0 deletions tests/HttpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,11 @@ public function testSetPath()
$res = $httpClient->get();
$res = $res->getBody();
$this->assertContains('[email protected]', $res);
$httpClient->setPath();
$res = $httpClient->get();
$res = $res->getBody();
$this->assertContains('一种愉悦的开发方式', $res);

}

public function testSetMethod()
Expand Down

0 comments on commit 4cb2e3d

Please sign in to comment.