filterRequest example

$transformer = $this->getContainer()->get(RequestTransformerInterface::class);
        $this->requestTransformer = $transformer;
    }

    public function setServerParameter(string $key, mixed $value): void
    {
        $this->server[$key] = $value;
    }

    protected function filterRequest(DomRequest $request): Request
    {
        $filteredRequest = parent::filterRequest($request);
        $transformedRequest = $this->requestTransformer->transform($filteredRequest);

        return $this->lastRequest = $transformedRequest;
    }

    /** * @param Response $response */
    protected function filterResponse(object $response): DomResponse
    {
        $event = new BeforeSendResponseEvent($this->lastRequest, $response);
        
$server['HTTP_REFERER'] = $this->history->current()->getUri();
        }

        if (empty($server['HTTP_HOST'])) {
            $server['HTTP_HOST'] = $this->extractHost($uri);
        }

        $server['HTTPS'] = 'https' === parse_url($uri, \PHP_URL_SCHEME);

        $this->internalRequest = new Request($uri$method$parameters$files$this->cookieJar->allValues($uri)$server$content);

        $this->request = $this->filterRequest($this->internalRequest);

        if (true === $changeHistory) {
            $this->history->add($this->internalRequest);
        }

        if ($this->insulated) {
            $this->response = $this->doRequestInProcess($this->request);
        } else {
            $this->response = $this->doRequest($this->request);
        }

        
Home | Imprint | This part of the site doesn't use cookies.