Skip to content

Commit

Permalink
fix: guzzle MalformedUriException
Browse files Browse the repository at this point in the history
  • Loading branch information
minchao committed Apr 2, 2022
1 parent 735334c commit e6e668e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use function getenv;
use function json_encode;
use function time;
use function substr;

/**
* @property Nodes\Item\Item $item
Expand Down Expand Up @@ -224,12 +225,16 @@ public function newRequest($uri, array $headers = [], $data = []): RequestInterf
$uri = Utils::uriFor($uri);
$path = $this->baseUrl->getPath() . $uri->getPath();

if (substr($path, 0, 1) !== '/') {
$path = '/' . $path;
}
$uri = $uri->withPath($path);

$uri = $uri
->withScheme($this->baseUrl->getScheme())
->withUserInfo($this->baseUrl->getUserInfo())
->withHost($this->baseUrl->getHost())
->withPort($this->baseUrl->getPort())
->withPath($path);
->withPort($this->baseUrl->getPort());

$jsonBody = $this->createJsonBody($data);

Expand Down

0 comments on commit e6e668e

Please sign in to comment.