-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doesn't work well with html plugin #2
Comments
Will have a look, ty for reporting 👍 |
Same happened to me a couple of hours ago |
Try upgrading to |
Reinstalled 0.0.5 but same happens. Depending on where I put it, it either doesn't do anything at all, or causes the browser to download a file |
import { Elysia } from "elysia"
import { swagger } from "@elysiajs/swagger"
import logger from "./plugins/basicLogger"
import successResponseFormatter from "./plugins/successResponseFormatter"
const app = new Elysia()
.use(logger)
.use(swagger())
.use(successResponseFormatter)
// Simulate a delay of at most one and a half second
.get("/:id", ({ params: { id } }) => Bun.sleep(Math.random() * 1_500).then(() => ({ id })))
.all("*", ({ set }) => { set.status = 404; return { success: false, error: "Not found" } })
.listen(3000)
console.log(`🦊 Elysia is running at ${app.server?.hostname}:${app.server?.port}`) This is my app. I tried introducing |
Somehow the content-type header is malformed
so when you open it in the browser it will download it |
#5, please make sure to have compression plugin use after HTML plugin |
Should be working on |
I found it wasn't playing well with the swagger plugin neither, so I chose to implement compression myself https:/BTS-CM/beet_api/blob/main/src/lib/cache.ts#L17 though i'll now need to add a compression flag so swagger can spit out uncompressed data too lol |
I was working on an app which uses the "@elysiajs/html" plugin, but depending on where I call .use(compression()), my browser would either download a file when I load my route, or it wouldn't apply compression at all.
For example, this code just made my browser download the file
but this code just never ran the compression
I am doing some other things in my app, so maybe there is another issue, but my fix was the remove the html() plugin and instead directly set the content-type in my routes so allow compression to be applied.
The text was updated successfully, but these errors were encountered: