Buckets:
ktongue/docker_container / .cache /opencode /node_modules /hono /dist /middleware /trailing-slash /index.js
| // src/middleware/trailing-slash/index.ts | |
| var trimTrailingSlash = () => { | |
| return async function trimTrailingSlash2(c, next) { | |
| await next(); | |
| if (c.res.status === 404 && (c.req.method === "GET" || c.req.method === "HEAD") && c.req.path !== "/" && c.req.path.at(-1) === "/") { | |
| const url = new URL(c.req.url); | |
| url.pathname = url.pathname.substring(0, url.pathname.length - 1); | |
| c.res = c.redirect(url.toString(), 301); | |
| } | |
| }; | |
| }; | |
| var appendTrailingSlash = () => { | |
| return async function appendTrailingSlash2(c, next) { | |
| await next(); | |
| if (c.res.status === 404 && (c.req.method === "GET" || c.req.method === "HEAD") && c.req.path.at(-1) !== "/") { | |
| const url = new URL(c.req.url); | |
| url.pathname += "/"; | |
| c.res = c.redirect(url.toString(), 301); | |
| } | |
| }; | |
| }; | |
| export { | |
| appendTrailingSlash, | |
| trimTrailingSlash | |
| }; | |
Xet Storage Details
- Size:
- 861 Bytes
- Xet hash:
- aa867b45f0e3aa5833a57806f7a76b4bcce2eba1345d059a796cf51ce4851a16
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.