src/Leevel/Session/Middleware/Session.php
public function terminate(Closure $next, IRequest $request, IResponse $response): void
    {
        $this->setPrevUrl($request);
        $this->saveSession();

        if (!$this->getSessionId($request)) {
            $response->setCookie(
                $this->manager->getName(),
                $this->manager->getId(),
                ['expire' => $this->getSessionExpire()]
            );
        }

        $next($request, $response);
    }
public function terminate(Closure $next, IRequest $request, IResponse $response): void
    {
        $this->setPrevUrl($request);
        $this->saveSession();

        if (!$this->getSessionId($request)) {
            $response->setCookie(
                $this->manager->getName(),
                $this->manager->getId(),
                ['expire' => $this->getSessionExpire()]
            );
        }

        $next($request, $response);
    }
响应.

@param \Closure               $next
@param \Leevel\Http\IRequest  $request
@param \Leevel\Http\IResponse $response