Process an incoming server request and return a response, optionally delegating
to the next middleware component to create the response.
353341
public function handle(ServerRequestInterface $request): ResponseInterface
    {
        if (false === $this->booted) {
            $this->boot();
        }

        try {
            return $this->pipe->handle($request);
        } catch (Exception $e) {
            $this->getContainer()->get('logger')->error($e);
        }
    }
706818
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $response = new \GuzzleHttp\Psr7\Response();
        $controller = $this->getController(
            new \phpGone\Router\Routeur(),
            $request
        );
        if (is_null($controller)) {
            return $handler->handle($request);
        }
        ob_start();
        $controller->execute();
        $responseController = ob_get_clean();
        $response->getBody()->write($responseController);
        return $response;
    }
1154817
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        if (!$this->isValid($request)) {
            return $this->createResponse(403);
        }

        return $handler->handle($request);
    }
686047
public function prepareResponse()
    {
        try {
            $this->setBaseMiddlewares();
            $this->handleRequest($this->middlewares);
            $this->router->build();
            $this->handleRequest($this->routeMiddlewares);
            $this->response = $this->router->run();
        } catch (Exception $exception) {
            $response = $this->container->call([$this->getExceptionHandler(), 'render'], [$exception]);
            $this->response = $response ?: $this->response;
        }
    }
549894
function(request, callback, response_middlewares) {
        var that = this;
        request.finalize(function(err, res) {
            if (err) callback(err, null);
            else that._callResponseMiddlewares(response_middlewares, res, callback);
        });
    }
1139404
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $method = $this->getOverrideMethod($request);

        if (!empty($method) && $method !== $request->getMethod()) {
            $allowed = $this->getAllowedOverrideMethods($request);

            if (!empty($allowed)) {
                if (in_array($method, $allowed)) {
                    $request = $request->withMethod($method);
                } else {
                    return $this->createResponse(405);
                }
            }
        }

        return $handler->handle($request);
    }
572187
def process_response(self, request, response):
        
        if not hasattr(request, 'location'):
            return response

        storage = storage_class(request=request, response=response)
        try:
            storage.set(location=request.location)
        except ValueError:
            # bad location_id
            pass
        return response
298627
public function process(ServerRequestInterface $request, RequestHandlerInterface $next) : ResponseInterface
    {
        $server = $request->getServerParams();
        $startTime = $server['REQUEST_TIME_FLOAT'] ?? microtime(true);

        $response = $next->handle($request);
        $diff = $this->getDiff($startTime);

        return $response->withHeader(self::HEADER, sprintf('%2.3fms', $diff));
    }
752675
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        //Session name
        if ($this->name) {
            $name = $this->name;
            $this->session->setName($name);
        } else {
            $name = $this->session->getName();
        }

        $this->session->start($this->options);

        $response = $handler->handle($request);

        if ($this->session->isStarted() && ($this->session->getName() === $name)) {
            $this->session->commit();
        }

        return $response;
    }
1005090
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        if (class_exists(StandardDebugBar::class)) {
            DebugBar::enable();

            DebugBar::initPDO(DB::connection()->getPdo());

            $response = $handler->handle($request);

            if ($this->shouldSendDataOnNextPage($response)) {
                DebugBar::stackData();
            } elseif ($this->shouldSendDataInHeaders($request)) {
                DebugBar::sendDataInHeaders();
            }

            return $response;
        }

        return $handler->handle($request);
    }
132674
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $uri = $request->getUri();

        if (strtolower($uri->getScheme()) !== 'https') {
            if ($this->mustRedirect($request)) {
                return $this->createResponse(301)
                    ->withHeader('Location', (string) self::withHttps($uri));
            }

            $request = $request->withUri(self::withHttps($uri));
        }

        $response = $handler->handle($request);

        if (!empty($this->maxAge)) {
            $header = sprintf(
                'max-age=%d%s%s',
                $this->maxAge,
                $this->includeSubdomains ? ';includeSubDomains' : '',
                $this->preload ? ';preload' : ''
            );
            $response = $response
                ->withHeader(self::HEADER, $header);
        }

        if ($response->hasHeader('Location')) {
            $location = parse_url($response->getHeaderLine('Location'));

            if (!empty($location['host']) && $location['host'] === $uri->getHost()) {
                $location['scheme'] = 'https';
                unset($location['port']);

                return $response->withHeader('Location', self::unParseUrl($location));
            }
        }

        return $response;
    }
789846
public function process(
        RequestInterface $request,
        ResponseInterface $response,
        DelegateInterface $next = null
    ) {
        // before
        $response = $this->before($request, $response);

        // next middleware
        if ($next) {
            $response = $next->next($request, $response);
        }

        // after
        return $this->after($request, $response);
    }
599309
public function process(
        ServerRequestInterface $p_request,
        RequestHandlerInterface $p_handler
    ): ResponseInterface {
        try {
            if ($this->checkRequest($p_request)) {
                return $this->encodeResponse(
                    $p_handler->handle(
                        $this->decodeRequest($p_request)
                    )
                );
            } else {
                if ($this->override) {
                    return $p_handler->handle($p_request);
                }
            }
        } catch (\Exception $ex) {
            return $this->createErrorResponse($ex);
        }
        return $this->createUnsupportedRequestResponse();
    }
87531
public function process(ServerRequestInterface $request,  RequestHandlerInterface $handler) : ResponseInterface
    {
        $body = $this->parseBody($request);
        $parsedBody = $request->getParsedBody();

        $request = $request->withParsedBody(array_merge($body, $parsedBody));

        return $handler->handle($request);
    }
164532
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $response = $handler->handle($request);

        if (stripos($request->getHeaderLine('Accept-Encoding'), $this->encoding) !== false
            && !$response->hasHeader('Content-Encoding')
        ) {
            $stream = $this->createStream($this->encode((string) $response->getBody()));

            return $response
                ->withHeader('Content-Encoding', $this->encoding)
                ->withoutHeader('Content-Length')
                ->withBody($stream);
        }

        return $response;
    }
1082856
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        //Only GET methods are allowed
        if ($request->getMethod() !== 'GET') {
            if ($this->continueOnError) {
                return $handler->handle($request);
            }

            return $this->createResponse(405)->withHeader('Allow', 'GET');
        }

        $file = static::getFilename($request->getUri()->getPath());

        if ($this->filesystem->has($file)) {
            return $this->read($request, $file);
        }

        //If the file does not exists, check if is gzipped
        $file .= '.gz';

        if (stripos($request->getHeaderLine('Accept-Encoding'), 'gzip') === false || !$this->filesystem->has($file)) {
            if ($this->continueOnError) {
                return $handler->handle($request);
            }

            return $this->createResponse(404);
        }

        return $this->read($request, $file)->withHeader('Content-Encoding', 'gzip');
    }
970227
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $request = $this->checkAttributes($request, $this->attributes);

        return $handler->handle($request);
    }