HttpServer, problems setting mime type



I’m new to HttpServer.jl . I am starting out by modifying one of the examples which works fine -of course- but when I insert links to other files (specifically css, in this case) they’re sent with the wrong MIME type. I thought it was going to be easy to fix. I did the following:

(1) Test each requested file for the type and save that to a variable.
(2) mime = mimetypes[type]
(3) res.headers["Content-Type"] = mime
(4) And even req.headers["Content-Type"] = mime …just because.

I print out the Content-Type and it is being set to text/css but the browser complains saying that the css files are sent with the text/html mime and so even though they arrive the page does not render properly because the styles are not applied.

I would appreciate any help I can get, thanks!


Awesome! …it’s working now.

I was digging through the HttpServer source files and found the following line of code:

        Response(200, Dict{AbstractString,AbstractString}([("Content-Type",mime)]), s)

This helped me to understand it a bit better.