1<?php
2
3namespace Seafile\Client\Http;
4
5/**
6 * Guzzle wrapper
7 *
8 * @package   Seafile\Http
9 * @author    Rene Schmidt DevOps UG (haftungsbeschränkt) & Co. KG <rene+_seafile_github@reneschmidt.de>
10 * @copyright 2015-2016 Rene Schmidt DevOps UG (haftungsbeschränkt) & Co. KG <rene+_seafile_github@reneschmidt.de>
11 * @license   https://opensource.org/licenses/MIT MIT
12 * @link      https://github.com/rene-s/seafile-php-sdk
13 */
14class Client extends \GuzzleHttp\Client
15{
16    /**
17     * Constructor
18     *
19     * @param array $config Client configuration settings.
20     */
21    public function __construct(array $config = [])
22    {
23        if (isset($config['base_uri']) && !preg_match("/\/api2$/", $config['base_uri'])) {
24            $config['base_uri'] .= '/api2';
25        }
26
27        $config = array_merge(
28            [
29                'http_errors'     => true,
30                'request.options' => [
31                    'verify'  => true,
32                    'headers' => [
33                        'Content-Type'  => 'application/json',
34                        'Authorization' => 'Token none',
35                    ],
36                ],
37            ],
38            $config
39        );
40
41        parent::__construct($config);
42    }
43}
44