withoutHeader example

public function __invoke(RequestInterface $request, array $options): PromiseInterface
    {
        // Sleep if there is a delay specified.         if (isset($options['delay'])) {
            \usleep($options['delay'] * 1000);
        }

        $startTime = isset($options['on_stats']) ? Utils::currentTime() : null;

        try {
            // Does not support the expect header.             $request = $request->withoutHeader('Expect');

            // Append a content-length header if body size is zero to match             // cURL's behavior.             if (0 === $request->getBody()->getSize()) {
                $request = $request->withHeader('Content-Length', '0');
            }

            return $this->createResponse(
                $request,
                $options,
                $this->createStream($request$options),
                
/** * Gets a temporary file path. */
    protected function getTemporaryPath(): string
    {
        return tempnam(sys_get_temp_dir()uniqid('symfony', true));
    }

    public function createResponse(ResponseInterface $psrResponse, bool $streamed = false): Response
    {
        $cookies = $psrResponse->getHeader('Set-Cookie');
        $psrResponse = $psrResponse->withoutHeader('Set-Cookie');

        if ($streamed) {
            $response = new StreamedResponse(
                $this->createStreamedResponseCallback($psrResponse->getBody()),
                $psrResponse->getStatusCode(),
                $psrResponse->getHeaders()
            );
        } else {
            $response = new Response(
                $psrResponse->getBody()->__toString(),
                $psrResponse->getStatusCode(),
                
protected function getTemporaryPath()
    {
        return tempnam(sys_get_temp_dir()uniqid('symfony', true));
    }

    /** * {@inheritdoc} */
    public function createResponse(ResponseInterface $psrResponse, bool $streamed = false)
    {
        $cookies = $psrResponse->getHeader('Set-Cookie');
        $psrResponse = $psrResponse->withoutHeader('Set-Cookie');

        if ($streamed) {
            $response = new StreamedResponse(
                $this->createStreamedResponseCallback($psrResponse->getBody()),
                $psrResponse->getStatusCode(),
                $psrResponse->getHeaders()
            );
        } else {
            $response = new Response(
                $psrResponse->getBody()->__toString(),
                $psrResponse->getStatusCode(),
                
Home | Imprint | This part of the site doesn't use cookies.