react-server675fbba4
react-servertreemainpackagesreact-serverlibhandlerstrailing-slash.mjs
packages/react-server/lib/handlers/trailing-slash.mjsmjs438 Bfa11324e
export default async function trailingSlash() {
  return async function trailingSlashRedirect({
    url: { pathname },
    request: { method },
  }) {
    if (
      pathname !== "/" &&
      pathname.endsWith("/") &&
      (method === "GET" || method === "HEAD")
    ) {
      return new Response(null, {
        status: 301,
        headers: {
          Location: pathname.replace(/\/+$/g, "") || "/",
        },
      });
    }
  };
}