hyper icon indicating copy to clipboard operation
hyper copied to clipboard

fileServer doesn't set content-type header

Open justinwoo opened this issue 8 years ago • 6 comments

for things like CSS files, the content-type needs to be written as text/css for Chrome to actually use it as a stylesheet, it seems.

justinwoo avatar Aug 19 '17 16:08 justinwoo

All right. Having Hyper guess MIME types based on file extensions seems like something we'd regret later. Perhaps some lookup table that is user-configurable, like with Nginx *https://github.com/h5bp/server-configs-nginx/blob/master/mime.types)?

owickstrom avatar Aug 31 '17 11:08 owickstrom

yeah, something like that would probably be best. like a default set and then the user could pass in their own record of how to handle stuff

justinwoo avatar Aug 31 '17 11:08 justinwoo

I'm very tight on time currently. If you need it soon, would you like to send a PR? Thanks!

owickstrom avatar Sep 01 '17 06:09 owickstrom

no rush! it's just on my vidtracker and i'm handling css requests separately for now

justinwoo avatar Sep 01 '17 07:09 justinwoo

I've added simple lookup table for mime types: https://github.com/owickstrom/hyper/blob/master/src/Hyper/Node/FileServer.purs#L28

We can break API in next release and allow users to pass their own table too if that is not enough.

@justinwoo, @owickstrom Can I close it?

paluh avatar Jul 15 '18 14:07 paluh

Looks like a good start @paluh. :+1: And yeah, let's make it a parameter when needed.

owickstrom avatar Jul 17 '18 18:07 owickstrom