APIRestTest::doHttpRequest PHP Method

doHttpRequest() protected method

protected doHttpRequest ( $method = "get", $relative_uri = "", $params = [] )
    protected function doHttpRequest($method = "get", $relative_uri = "", $params = array())
    {
        if (!empty($relative_uri)) {
            $params['headers']['Content-Type'] = "application/json";
        }
        $method = strtolower($method);
        if (in_array($method, array('get', 'post', 'delete', 'put', 'options', 'patch'))) {
            try {
                return $this->http_client->{$method}($this->base_uri . $relative_uri, $params);
            } catch (Exception $e) {
                if ($e->hasResponse()) {
                    $this->last_error = $e->getResponse();
                }
                throw $e;
            }
        }
    }