-
Notifications
You must be signed in to change notification settings - Fork 67
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
Port MIME type detection over from HttpServer.jl #68
Conversation
Here's the old implementation that I'm essentially restoring: Line 20 in 6aec344
|
Codecov Report
@@ Coverage Diff @@
## master #68 +/- ##
=========================================
+ Coverage 90.56% 90.9% +0.34%
=========================================
Files 5 6 +1
Lines 53 55 +2
=========================================
+ Hits 48 50 +2
Misses 5 5
Continue to review full report at Codecov.
|
Maybe this could be moved to HTTP eventually, but for now this PR is a good practical solution. |
Thank you for the great work you are putting in. This may belong in a new HttpCommon in the end, but for now I will refer Mux.jl in private repositories. Would you consider including some additional extensions? I always add these lines to HttpServer (sorry for layout) Add some mime types, which some browsers support.HttpServer.mimetypes["jl"]= "text/plain" |
I don't actually know much about the details of MIME types. The Maybe we can decide whether to add those as part of a separate PR? I'd like to get the original issue fixed as soon as possible. |
Yes! Not loading any css library right now in WebIO is pretty bad, I think we can discuss in a separate PR which other mimetype detection we want to add and whether we want to allow a mechanism to customize this detection on the user side. |
Not adding these is of course just fine. The more one adds, the less general the code becomes. |
Fixes JuliaGizmos/WebIO.jl#181
This was broken in the transition from HttpServer.jl to HTTP.jl. There's a TODO in the code to switch to
HTTP.sniff()
but that doesn't quite work. The problem is thatHTTP.sniff()
only operates on the file contents and not the extension, so it always returnstext/plain
for things like.css
files, while old implementation correctly returnedtext/css
.To avoid a new dependency, I just copied over the whole
mimetypes.jl
file from HttpServer into Mux. It's not an elegant solution, but given that the current behavior is broken, I think it's necessary. In the future, we could consider moving the mimetype list elsewhere.