修改 User Agent
This commit is contained in:
parent
948f7a2805
commit
25b490d7b8
@ -71,7 +71,7 @@ public function remote($func, $requests): array
|
|||||||
|
|
||||||
public function http(): PendingRequest
|
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
|
private function getResponse(Response $response): array
|
||||||
|
@ -34,13 +34,15 @@ public function boot(): void
|
|||||||
|
|
||||||
Http::macro('module', function ($api_token, $url) {
|
Http::macro('module', function ($api_token, $url) {
|
||||||
// 关闭证书验证
|
// 关闭证书验证
|
||||||
return Http::withoutVerifying()->withHeaders([
|
return Http::baseUrl($url)
|
||||||
'X-Module-Api-Token' => $api_token,
|
->withUserAgent('LAECloud-Client')
|
||||||
'Content-Type' => 'application/json',
|
->withHeaders([
|
||||||
'Accept' => 'application/json',
|
'X-Module-Api-Token' => $api_token,
|
||||||
])->withOptions([
|
'Content-Type' => 'application/json',
|
||||||
'version' => 2,
|
'Accept' => 'application/json',
|
||||||
])->baseUrl($url);
|
])->withOptions([
|
||||||
|
'version' => 2,
|
||||||
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user