summaryrefslogtreecommitdiff
path: root/src/Http/HttpClientServiceProvider.php
blob: 113af71311db348313e8deecef8cf545ecd0624b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php

namespace Engelsystem\Http;

use Engelsystem\Container\ServiceProvider;
use GuzzleHttp\Client as GuzzleClient;

class HttpClientServiceProvider 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,
                    ];
                }
            );
    }
}