Converts a PSR request into a BuzzRequest request.

@param RequestInterface $request

@return BuzzRequest
769571
private function createRequest(RequestInterface $request)
    {
        $buzzRequest = new BuzzRequest();
        $buzzRequest->setMethod($request->getMethod());
        $buzzRequest->fromUrl($request->getUri()->__toString());
        $buzzRequest->setProtocolVersion($request->getProtocolVersion());
        $buzzRequest->setContent((string) $request->getBody());

        $this->addPsrHeadersToBuzzRequest($request, $buzzRequest);

        return $buzzRequest;
    }
245600
private function doSearch(RequestInterface $request)
    {
        $searchRequest = [
            'index' => $request->getIndex(),
            'type'  => $request->getType(),
            'body'  => $this->requestMapper->buildSearchRequest($request),
        ];

        return $this->client->search($searchRequest);
    }
461109
public function execute(RequestInterface $request): RequestInterface
    {
        if ($request->getUri()->getPath() === self::ENDPOINT_INSTALLATION) {
            return $request;
        } else {
            $signature = $this->determineRequestSignature(
                $request->getUri(),
                $request->getMethod(),
                $request->getBody()->getContents(),
                $request->getHeaders()
            );

            return $request->withHeader(self::HEADER_CLIENT_SIGNATURE, $signature);
        }
    }
1100008
public function onRequest( RequestInterface $request ) {
        $apiKey = $this->getEndpoint()->getApiKey();

        if($apiKey !== null) {
            $request = $request->withHeader( 'Authorization', 'Bearer '.$apiKey);
        }

        return $request;
    }
805939
public function send(RequestInterface $request)
	{
		$request = $this->authentication($request);
		$defaultHeaders = [
			'Accept'       => $this->getContentType(),
			'Content-Type' => $this->getContentType()
		];

		foreach ($defaultHeaders as $defaultHeader => $value)
		{
			if ( ! $request->hasHeader($defaultHeader))
			{
				$request = $request->withHeader($defaultHeader, $value);
			}
		}

		$response = $this->client->sendRequest($request);
		$response = $this->transformResponseToException($request, $response);

		return $response;
	}
67620
public function getTokenFromRequest( RequestInterface $request ) {
		if ( $request->get( $this->key ) ) {
			return $request->get( $this->key );
		}

		if ( $request->post( $this->key ) ) {
			return $request->post( $this->key );
		}

		if ( $request->headers( $this->header ) ) {
			return $request->headers( $this->header );
		}

		return '';
	}
387588
public function getRequest(RequestInterface $request)
    {
        $requestStr = $this->parser->getRequestAsString($request);
        $endpoint = (string)$request->getUri();
        $method = $request->getMethod();

        return [
            'request' => $requestStr,
            'endpoint' => $endpoint,
            'method' => $method,
        ];
    }
588148
public function sendAsyncRequest(RequestInterface $request)
    {
        try {
            return new Promise\HttpFulfilledPromise($this->sendRequest($request));
        } catch (Exception $e) {
            return new Promise\HttpRejectedPromise($e);
        }
    }
586046
private function appendQueryParams(RequestInterface $request)
    {
        $queryParams = $this->auth->getQueryParameters();
        foreach ($queryParams as $key => $value) {
            $uri = Uri::withQueryValue($request->getUri(), $key, $value);
            $request = $request->withUri($uri);
        }
        return $request;
    }
970977
public static function renderRequestHeaders(RequestInterface $request): string
    {
        $renderedHeaders = '';
        $headers = $request->getHeaders();
        if ($headers instanceof Headers) {
            $renderedHeaders .= $headers->__toString();
        } else {
            foreach (array_keys($headers) as $name) {
                $renderedHeaders .= $request->getHeaderLine($name);
            }
        }

        return $renderedHeaders;
    }
359693
public function getResponse(RequestInterface $request)
    {
        $this->write($request->getPacket());

        return $request->getResponse()->init($this->read());
    }
129958
protected function handleRequest(RequestInterface $request)
    {
        if (!$this->getOption('batch', false)) {
            $response = $this->client->send($request);
            return $this->normalizeResponse($response);
        }
        $this->requests[] = $request;
    }
149003
private function getRootFilter(RequestInterface $request)
    {
        $filter = null;

        if ($request->getFilter()) {
            $filter = $this->queryBuilder->buildQuery($request->getFilter());
        }

        return $filter;
    }
287066
public function sendAsync(RequestInterface $request)
    {
        return $this->httpClient->sendAsync($request)->then(
            function (ResponseInterface $response) use ($request) {
                return $request->getRpcId() ? $response : null;
            }
        );
    }
69287
private function appendHeaders(RequestInterface $request)
    {
        $headers = $this->auth->getHeaders();
        foreach ($headers as $key => $value) {
            $request = $request->withHeader($key, $value);
        }
        return $request;
    }
816292
protected function authenticateRequest(RequestInterface $request)
    {
        $uri = $request->getUri();
        parse_str($uri->getQuery(), $query);

        $query['key'] = Configuration::get('key');
        $query['token'] = Configuration::get('token');

        $uri = $uri->withQuery(http_build_query($query));

        return $request->withUri($uri);
    }
762845
public function next(RequestInterface $request)
    {
        if (!count($this->processingStack) && $this->responseSourceDelegate) {
            return $this->responseSourceDelegate->next($request);
        }
        return parent::next($request);
    }