外部へのHTTPリクエストに独自のUser-Agentを付与する
This commit is contained in:
parent
da8af95043
commit
4c04deb80f
@ -3,6 +3,8 @@
|
|||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
use App\MetadataResolver\MetadataResolver;
|
use App\MetadataResolver\MetadataResolver;
|
||||||
|
use GuzzleHttp\Client;
|
||||||
|
use GuzzleHttp\RequestOptions;
|
||||||
use Illuminate\Support\Facades\Blade;
|
use Illuminate\Support\Facades\Blade;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Parsedown;
|
use Parsedown;
|
||||||
@ -36,5 +38,12 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
$this->app->singleton('parsedown', function () {
|
$this->app->singleton('parsedown', function () {
|
||||||
return Parsedown::instance();
|
return Parsedown::instance();
|
||||||
});
|
});
|
||||||
|
$this->app->bind(Client::class, function () {
|
||||||
|
return new Client([
|
||||||
|
RequestOptions::HEADERS => [
|
||||||
|
'User-Agent' => 'TissueBot/1.0'
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user