diff options
Diffstat (limited to 'src/Http')
-rw-r--r-- | src/Http/GuzzleServiceProvider.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/Http/GuzzleServiceProvider.php b/src/Http/GuzzleServiceProvider.php new file mode 100644 index 00000000..f81a91f5 --- /dev/null +++ b/src/Http/GuzzleServiceProvider.php @@ -0,0 +1,25 @@ +<?php + +namespace Engelsystem\Http; + +use Engelsystem\Container\ServiceProvider; +use GuzzleHttp\Client as GuzzleClient; + +class GuzzleServiceProvider extends ServiceProvider +{ + public function register() + { + $this->app->when(GuzzleClient::class) + ->needs('$config') + ->give( + function () { + return [ + // No exception on >= 400 responses + 'http_errors' => false, + // Wait max n seconds for a response + 'timeout' => 2.0, + ]; + } + ); + } +} |