Pantheon\Terminus\Request\Request::send PHP Method

send() private method

Sends a request to the API
private send ( string $uri, string $method, array $arg_params = [] ) : Psr\Http\Message\ResponseInterface
$uri string URL for API request
$method string Request method (i.e. PUT, POST, DELETE, or GET)
$arg_params array Request parameters
return Psr\Http\Message\ResponseInterface
    private function send($uri, $method, array $arg_params = [])
    {
        $host = $this->getConfig()->get('host');
        $extra_params = ['headers' => ['User-Agent' => $this->userAgent(), 'Content-type' => 'application/json'], RequestOptions::VERIFY => strpos($host, 'onebox') === false];
        if ((!isset($arg_params['absolute_url']) || !$arg_params['absolute_url']) && ($session = $this->session()->get('session', false))) {
            $extra_params['headers']['Authorization'] = "Bearer {$session}";
        }
        $params = array_merge_recursive($extra_params, $arg_params);
        if (isset($params['form_params'])) {
            $params['json'] = $params['form_params'];
            unset($params['form_params']);
        }
        $params[RequestOptions::VERIFY] = strpos($host, 'onebox') === false;
        $client = new Client(['base_uri' => $this->getBaseUri(), 'cookies' => $this->fillCookieJar($params)]);
        unset($params['cookies']);
        $this->logger->debug("#### REQUEST ####\nParams: {params}\nURI: {uri}\nMethod: {method}", ['params' => json_encode($params), 'uri' => $uri, 'method' => $method]);
        //Required objects and arrays stir benign warnings.
        error_reporting(E_ALL ^ E_WARNING);
        $request = new HttpRequest(ucwords($method), $uri, $params);
        error_reporting(E_ALL);
        $response = $client->send($request, $params);
        return $response;
    }