public function generateHttpClient()
    {
        $config = $this->config;
        if (!array_key_exists('handler', $config)
            || $config['handler'] === null) {
            $config['handler'] = HandlerStack::create();
        }

        // Add a logging middleware required by this library.
        $config['handler']->before(
            'http_errors',
            GuzzleLogMessageHandler::log($this->logger, $this->messageFormatter)
        );

        return new Client($config);
    }