Initialize event

@param RequestInterface $request
190079
protected function initEvent(RequestInterface $request)
    {
        $event = new GuzzleHttpEvent();
        $event->setExecutionStart();
        $event->setRequest($request);
        $event->setClientId($this->clientId);

        $this->events[$this->getEventKey($request)] = $event;
    }
381975
public function handle(RequestInterface $request)
    {
        $interface = (string) Application::DISPATCHER;

        $dispatcher = new Dispatcher($this->original);

        $this->application->set($interface, $dispatcher);

        return $this->application->handle($request);
    }
1072473
private function createHttpRequest(RequestInterface $request)
    {
        // Handle authentication first
        if ($this->authenticationMethod) {
            $request = $this->authenticationMethod->authorizeRequest($this, $request);
        }
        
        // The URL
        $url = ltrim(trim($request->getUrl()), '/');
        
        // Handle templated URLs
        if ($urlVariables = $request->getUrlVariables()) {
            $url = (new UriTemplate())->expand($url, $urlVariables);
        }
        
        // Headers
        $headers = [];
        $headersToAdd = $request->getHeaders();
        
        // The message body
        $body = null;
        if ($messageBody = $request->getMessageBody()) {
            $headers['Content-Type'] = $messageBody->getContentType();
            $headers['Content-Length'] = $messageBody->getContentLength();
            $body = $messageBody->getContent();
        }
        
        // Accept hal+json response
        if ($this->profile) {
            $headers['Accept'] = 'application/hal+json; profile="' . $this->profile . '"';
        } else {
            $headers['Accept'] = 'application/json';
        }
        
        // Prepare the Guzzle request
        if (Misc::isGuzzle6()) {
            // Guzzle 6
            $httpRequest = new \GuzzleHttp\Psr7\Request(
                $request->getMethod(),
                $url,
                array_merge($headers, $headersToAdd),
                $body ? \GuzzleHttp\Psr7\stream_for($body) : null
            );
        } else {
            // Guzzle 5.3
            $httpRequest = $this->client->createRequest($request->getMethod(), $url, ['exceptions' => false]);
            
            // verify option for HTTPS requests if needed
            if (($verify = Misc::verify($url, __DIR__ . '/../CA/')) !== null) {
                $httpRequest->getConfig()->set('verify', $verify);
            }
            
            foreach ($headers as $key => $value) {
                $httpRequest->setHeader($key, $value);
            }
            
            foreach ($headersToAdd as $key => $value) {
                $httpRequest->setHeader($key, $value);
            }
            
            if ($body) {
                $httpRequest->setBody(\GuzzleHttp\Stream\Stream::factory($body));
            }
        }
        
        return $httpRequest;
    }
1175036
protected function setDataFromRequest(RequestInterface $request)
    {
        $keys = $this->validDataFromRequest();
        $data = $request->getParams($keys);
        $this->mergeData($data);

        return $this;
    }
1371934
private function createRequest(RequestInterface $request)
    {
        $options = [
            'exceptions' => false,
            'allow_redirects' => false,
        ];

        $options['version'] = $request->getProtocolVersion();
        $options['headers'] = $request->getHeaders();
        $body = (string) $request->getBody();
        $options['body'] = '' === $body ? null : $body;

        return $this->client->createRequest(
            $request->getMethod(),
            (string) $request->getUri(),
            $options
        );
    }
1278616
public function init($request)
    {
        $cache = new Cache();
        if ($this->getServiceConfig()->getShopEdition() === ServiceConfig::EDITION_ENTERPRISE) {
            $cache->clearCacheBackend();
            if ($request->getParameter('clearVarnish')) {
                $cache->clearReverseProxyCache();
            }
        }
        $cache->clearTemporaryDirectory();
    }
665817
public function handle(RequestInterface $request)
    {
        $message = sprintf($this->message, $this->response);

        throw new \LogicException($message);
    }
139884
protected function prepareOptions(RequestInterface $request)
    {
        $this->options[CURLOPT_URL] = (string)$request->getUri();
        $this->options[CURLOPT_HTTP_VERSION] = $request->getProtocolVersion();

        // Set request method
        if (strtoupper($request->getMethod()) === 'GET') {
            $this->options[CURLOPT_HTTPGET] = true;
        } elseif (strtoupper($request->getMethod()) === 'HEAD') {
            $this->options[CURLOPT_NOBODY] = true;
        } else {
            $this->options[CURLOPT_CUSTOMREQUEST] = $request->getMethod();
        }

        // Prepare and set request headers
        foreach ($request->getHeaders() as $name => $values) {
            foreach ($values as $value) {
                $this->options[CURLOPT_HTTPHEADER][] = sprintf('%s: %s', $name, $value);
            }
        }

        curl_setopt_array($this->handle, $this->options);
    }
370509
public function initializeController(RequestInterface $request, ResponseInterface $response)
    {
        parent::initializeController($request, $response);
        $this->feedbackCollection->setControllerContext($this->getControllerContext());
    }
258648
public function init(HTTPRequest $request)
    {

        if (!$this->isStarted() && $this->requestContainsSessionId($request)) {
            $this->start($request);
        }

        // Funny business detected!
        if (isset($this->data['HTTP_USER_AGENT'])) {
            if ($this->data['HTTP_USER_AGENT'] !== $this->userAgent($request)) {
                $this->clearAll();
                $this->destroy();
                $this->started = false;
                $this->start($request);
            }
        }
    }
1021944
public function setRequest(\Psr\Http\Message\RequestInterface $request) : \Psr\Http\Message\RequestInterface
    {
        return $this->request = $request;
    }
287343
public function sendRequest(RequestInterface $request): void
    {
        $requestId = $this->getRequestId($request);
        $this->pendingRequests[$requestId] = $this->createPromiseForRequest($request, true);
    }
1316945
private function query(RequestInterface $request)
    {
        return $this->client->send($request, array_merge(
            [RequestOptions::HTTP_ERRORS => false],
            $this->clientOptions
        ));
    }
808413
protected function beforeSend(RequestInterface $request)
    {
        try {
            $state = $request->setState(RequestInterface::STATE_TRANSFER);
            if ($state == RequestInterface::STATE_TRANSFER) {
                // Add the request curl handle to the multi handle
                $this->checkCurlResult(curl_multi_add_handle($this->multiHandle, $this->createCurlHandle($request)->getHandle()));
            } else {
                // Requests might decide they don't need to be sent just before transfer (e.g. CachePlugin)
                $this->remove($request);
                if ($state == RequestInterface::STATE_COMPLETE) {
                    $this->successful[] = $request;
                }
            }
        } catch (\Exception $e) {
            // Queue the exception to be thrown when sent
            $this->removeErroredRequest($request, $e);
        }
    }
1269822
public function initializeRequest($request = null)
	{
		if (empty($request)) {
			$this->request = Request::createFromGlobals();
		} else {
			$this->request = $request;
		}

		// Shortcuts to the request object for cleaner syntax.
		$this->input = new Input($this->request);
	}
723503
protected function sendRequest(RequestInterface $request)
    {
        $response = $this->client->send($request);
        /* @var \Psr\Http\Message\ResponseInterface $response */

        return json_decode($response->getBody(), true);
    }
103573
public function renderIntoCookieHeader(RequestInterface $request) : RequestInterface
    {
        $cookieString = implode('; ', $this->cookies);

        $request = $request->withHeader(static::COOKIE_HEADER, $cookieString);

        return $request;
    }