getUri()->getPath(); if (!empty($uri) && $uri[-1] === "/") { return (new \GuzzleHttp\Psr7\Response()) ->withStatus(301) ->withHeader('Location', substr($uri, 0, -1)); } return $next($request); } }