Skip to content

Commit

Permalink
chore: apply changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyrisbee committed Dec 1, 2023
1 parent 2c74f80 commit 151f339
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
14 changes: 8 additions & 6 deletions src/Requests/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,16 @@ protected function request(
string $path,
array $options = [],
): stdClass|array|bool {
$response = $this
->app
->http
$http = $this->app->http
->withoutVerifying()
->withoutRedirecting()
->withUserAgent($this->app->userAgent())
->withBasicAuth($this->app->username(), $this->app->password())
->{$method}($this->getUrl($path), $options);
->withBasicAuth($this->app->username(), $this->app->password());

if ($this->app->userAgent()) {
$http->withUserAgent($this->app->userAgent());
}

$response = $http->{$method}($this->getUrl($path), $options);

if (!($response instanceof Response)) {
throw new UnexpectedValueException();
Expand Down
4 changes: 2 additions & 2 deletions src/WordPress.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class WordPress

protected string $password;

protected string $userAgent = 'Storipress/WordPress/2023-12-01';
protected ?string $userAgent;

public function __construct(
public Factory $http,
Expand Down Expand Up @@ -111,7 +111,7 @@ public function tag(): Tag
return $this->tag;
}

public function userAgent(): string
public function userAgent(): ?string
{
return $this->userAgent;
}
Expand Down

0 comments on commit 151f339

Please sign in to comment.