@param Request  $request
@param Response $response
@param array    $options

@return Response
430274
public function send(Request $request, Response $response, array $options = array()) {
    $this->setupAuth($request);
    $this->_client->send($request, $response, $options);
    return $response;
  }
1330799
public function request($method, $uri = null, array $options = [], $asJson = true)
    {
        $response = parent::request($method, $uri, $options);

        if ($response->getStatusCode() !== 200) {
            ErrorHandler::handleErrorResponse($response);
        }

        if ($asJson) {
            return json_decode($response->getBody(), true);
        }

        return $response->getBody()->getContents();
    }
360934
private function sendRequest($method, $url, array $options = [])
    {
        $response = $this->httpClient->request((string)$method, $url, $options);

        return json_decode($response->getBody(), true);
    }
423324
protected function request($options = [])
    {
        try {
            $params = array_filter($this->params);
            $response = $this->getClient()
                ->get($this->getUrl(), ['query' => $params], $options);

            return trim($this->format) === 'json'
                ? json_decode($response->getBody(), true)
                : simplexml_load_string($response->getBody());
        } catch (RequestException $e) {
            return null;
        }
    }
824167
protected function sendRequest(string $method, string $uri, array $options = []): array
    {
        $request = $this->client->createRequest($method, $uri);

        $key = $method === Api::GET ? 'query' : 'form_params';
        $options[$key] = $this->signRequest(
            $method,
            $request->getUri()->__toString(),
            $options[$key] ?? []
        );

        return $this->processResponse(
            $this->client->send($request, $options)
        );
    }
531991
public function request($method, $url, $token, array $options = [])
    {
        $request = $this->getAuthenticatedRequest(
            $method, $url, $token, $options
        );

        return $this->getResponse($request);
    }
639146
public function process(Request $request, array &$options = array())
    {
        if (!isset($options['article']) || !$options['article'] || !$options['article'] instanceof Article) {
            throw new NotFoundHttpException('Cannot retrieve article.');
        }

        /** @var Article $article */
        $article = $options['article'];
        if ($request->isMethod('post')) {
            $parameters = array_keys($request->request->all());
            if (!$this->chain->has($parameters[0])) {
                throw new \InvalidArgumentException(sprintf('You must implement a vince_cms.processor tagged service for form %s.', $parameters[0]));
            } else {
                $return = $this->chain->get($parameters[0])->setOptions($options)->process($request);

                // Processor returns a Response object
                if (is_object($return) && $return instanceof Response) {
                    return $return;

                // Processor returns Form object
                } elseif (is_object($return) && $return instanceof Form) {
                    $options['form'] = $return->createView();

                    // Response is build in controller
                    return false;

                // Processor returns array
                } elseif (is_array($return)) {
                    $options = array_merge($return, $options);

                    // Response is build in controller
                    return false;

                // Processor returns boolean
                } elseif (is_bool($return)) {
                    return !$return ?: new RedirectResponse($this->router->generate($article->getRouteName()), 302);
                }
            }
        }

        return false;
    }
487364
public function toResponse($status = 200, array $headers = [], $options = 0)
    {
        return new JsonResponse($this->transform(), $status, $headers, $options);
    }
8680
public function post($url, array $params = null, array $options = array())
	{
		return $this->request($url, 'POST', $params, $options);
	}
405525
public function checkRedirect(
        RequestInterface $request,
        array $options,
        ResponseInterface $response
    ) {
        if (substr($response->getStatusCode(), 0, 1) != '3'
            || !$response->hasHeader('Location')
        ) {
            return $response;
        }

        $this->guardMax($request, $options);
        $nextRequest = $this->modifyRequest($request, $options, $response);

        if (isset($options['allow_redirects']['on_redirect'])) {
            call_user_func(
                $options['allow_redirects']['on_redirect'],
                $request,
                $response,
                $nextRequest->getUri()
            );
        }

        /** @var PromiseInterface|ResponseInterface $promise */
        $promise = $this($nextRequest, $options);

        // Add headers to be able to track history of redirects.
        if (!empty($options['allow_redirects']['track_redirects'])) {
            return $this->withTracking(
                $promise,
                (string) $nextRequest->getUri(),
                $response->getStatusCode()
            );
        }

        return $promise;
    }
205626
public function post($url, array $options = [])
    {
        return $this->responseBuilder->build($this->send(new Request('POST', $url), $options));
    }
346183
public function requestRaw(string $url, string $method = 'GET', array $options = [])
    {
        return Response::buildFromPsrResponse($this->request($url, $method, $options, true));
    }
1145036
public function render(Request $request, array $options = array())
    {
        return $this->doRender(
            $options + array(
                'shortname' => $this->shortName,
                'identifier' => $request->getPathInfo(),
                'count' => $this->count,
            )
        );
    }
904881
public function delete($uri, $body = null, array $options = [])
    {
        return $this->request(self::REQUEST_METHOD_DELETE, $uri, $body, $options);
    }
386843
protected function buildStringResponse($content, $headers = [], $options = 0)
    {
        $headers = array_merge($headers, $this->headers);

        $data = [
            'data' => $content,
        ];

        $response = new JsonResponse($data, $this->getStatusCode(), $headers, $options);

        return $response;
    }
987804
public function create($options = [])
    {
        $params = $this->toArray($options);
        $recipients['recipients'] = [$params];

        $uri = $this->uri();
        $createResult = static::post($this->client, $uri, [
            'json' => $recipients,
        ]);

        if (isset($createResult['errors'])) {
            throw new ResponseException($createResult['errors']);
        }

        $recipientData = array_filter($createResult['recipients'], function ($recipient) use ($params) {
            return $recipient['email'] == $params['email'];
        });

        return $this->parseArray(array_pop($recipientData));
    }
1144465
private static function request($options = array()) {
    $body = "";
    $headers = array(
      "Accept: application/json",
      "User-Agent: ".self::$userAgentName."/".Api::getVersion()
    );
    $method = "GET";

    if (!empty($options["method"])) {
      $method = $options["method"];
    }

    if (!empty($options["body"])) {
      array_push($headers, "Content-Type: application/json");
      $body = json_encode($options["body"]);
      array_push($headers, "Content-Length: ".strlen($body));
    }

    $sign = false;
    if (!empty($options["sign"])) {
      $sign = $options["sign"];
    }

    if ($sign) {
      $signResult = self::signRequest(array(
        "body" => $body,
        "method" => $method,
        "path" => $options["path"]
      ));
      $headers = array_merge($headers, $signResult["headers"]);
    }

    $curlResult = self::curl(array(
      "url" => Api::getAuthservicesUrl().$options["path"],
      "method" => $method,
      "body" => $body,
      "headers" => $headers
    ));

    if (!empty($curlResult["errorCode"]) && !empty($curlResult["errorMessage"])) {
      throw new \Exception($curlResult["errorMessage"], $curlResult["errorCode"]);
    }

    $isResponseOk = true;
    if ($curlResult["status"] < 200 || $curlResult["status"] > 299) {
      $isResponseOk = false;
    }

    $responseData = json_decode($curlResult["body"]);

    if (!$isResponseOk) {
      if (!empty($responseData->message) && !empty($responseData->code) && !empty($responseData->wlt)) {
        throw new \Exception($responseData->message.", request id: ".$responseData->wlt, $responseData->code);
      } else {
        throw new \Exception("HTTP status is not 2xx");
      }
    }

    return $responseData;
  }