修改 User Agent

This commit is contained in:
iVampireSP.com 2023-01-19 16:17:17 +08:00
parent 948f7a2805
commit 25b490d7b8
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132
2 changed files with 10 additions and 8 deletions

View File

@ -71,7 +71,7 @@ public function remote($func, $requests): array
public function http(): PendingRequest
{
return Http::module($this->api_token, $this->url)->acceptJson()->timeout(5)->withUserAgent('LAECloud-Client');
return Http::module($this->api_token, $this->url)->acceptJson()->timeout(5);
}
private function getResponse(Response $response): array

View File

@ -34,13 +34,15 @@ public function boot(): void
Http::macro('module', function ($api_token, $url) {
// 关闭证书验证
return Http::withoutVerifying()->withHeaders([
return Http::baseUrl($url)
->withUserAgent('LAECloud-Client')
->withHeaders([
'X-Module-Api-Token' => $api_token,
'Content-Type' => 'application/json',
'Accept' => 'application/json',
])->withOptions([
'version' => 2,
])->baseUrl($url);
]);
});