lukeed / sirv

An optimized middleware & CLI application for serving static files~!
MIT License
1.06k stars 56 forks source link

fix: append charset=utf-8 to text/html #122

Closed aleclarson closed 2 years ago

aleclarson commented 2 years ago

Closes #106

I considered fixing this upstream in "mime" or "mime-db" packages, but then I came across these issues, which indicated that it's not a viable path.

https://github.com/broofa/mime/issues/174 https://github.com/jshttp/mime-db/issues/94

Size before: 5204 bytes Size after: 5108 bytes (-96)

aleclarson commented 2 years ago

Hmm, I guess wc -c isn't accurate.

The build script reports 3.07 kB before and 3.03 kB after (for mjs module).

lukeed commented 2 years ago

Thanks! I'll review eod tomorrow or the weekend and get a release out. I'll tweak code style here a bit but that's on me, no worries :)

Can you add a test though, just to lock it in for the future? Ty