-
Notifications
You must be signed in to change notification settings - Fork 374
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
The serveDirectory
middleware sends JS files as application/javascript
(3.0.0-RC7)
#2855
Comments
It seems that the main issue is the absence of the |
/bounty $50 |
💎 $50 bounty • ZIOSteps to solve:
Thank you for contributing to zio/zio-http! Add a bounty • Share on socials
|
💡 @987Nabil submitted a pull request that claims the bounty. You can visit your bounty board to reward. |
🎉🎈 @987Nabil has been awarded $50! 🎈🎊 |
Describe the bug
The
serveDirectory
middleware sends JS files asapplication/javascript
, whereas i.ecaddy
working as a file server sends them astext/javascript; charset=utf-8
.To Reproduce
Steps to reproduce the behaviour:
public
with at least one JavaScript fileMiddleware.serveDirectory(Path.empty, new File("public"))
caddy file-server --listen :9000 --root public/
Expected behaviour
It seems that the main difference between Caddy and ZIO HTTP is
content-type
. I suspect that if ZIO HTTP sends the same content type, the browser will execute JS without a problem.Screenshots
See the error in the attached screenshot.
Desktop (please complete the following information):
Additional context
The JS in question is a bundle that contains JSX and all kinds of stuff, but I suspect the problem might occur with any JS file. I'm using ZIO HTTP 3.0.0-RC7.
The text was updated successfully, but these errors were encountered: