elysiajs / elysia

Ergonomic Framework for Humans
https://elysiajs.com
MIT License
9.74k stars 207 forks source link

Elysia can not handle BuildArtifact properly #576

Open ghost opened 5 months ago

ghost commented 5 months ago

What version of Elysia.JS is running?

1.0.9

What platform is your computer?

Linux 5.15.0-101-generic x86_64 x86_64

What steps can reproduce the bug?

const { outputs: [file] } = await Bun.build(/* build something that outputs js file */)

new Elysia().get('/', file);

What is the expected behavior?

Lets say that file is a js file, then the Content-Type should be text/javascript...

What do you see instead?

Content-Type: application/json;charset=utf-8 Content-Length: 2 the file way bigger than that

Additional information

Elysia should handle BuildArtifact properly, since BuildArtifact is an extension of BunFile.

Workaround:

new Elysia().get('/', Bun.file(file.path));
ghost commented 5 months ago

I took a look at how you guys deal with literal values. The problem is that BuildArtifact.constructor.name happens to be Object instead of Blob.