Closed
Description
What happen?
When you are using staticPlugin({prefix: '/'})
with mount()
method,
Your fetch function faces req.url
argument will rewrited as /
all times.
Reproduction code
reproduction.ts
import { Elysia } from 'elysia';
import { staticPlugin } from "@elysiajs/static";
const app = new Elysia();
app.mount("/test/", async (req) =>{
console.log(req.url);
return new Response("test");
});
app.use(staticPlugin({ prefix: "/" }));
export default {
port: 3000,
fetch: app.fetch,
};
run bun run reproduction.ts
and access http://localhost:3000/test/hogehoge.js
or http://localhost:3000/test/fugafuga.png
something so on,
then you will see the output is http://localhost:3000/
instead of expected http://localhost:3000/hogehoge.js
or http://localhost:3000/fugafuga.png
.
Environment
- Linux 6.9.3-3
- bun 1.1.15
- elysia 1.0.25
- @elysiajs/static 1.0.3
Metadata
Metadata
Assignees
Labels
No labels