HTTP server in cljs.browser.repl doesn't serve files with extensions other than specified in ext->mime-type

Description

Adding an entry to cljs.repl.browser/ext->mime-type superficially fixes that.

1) Currently used MIME type identification is very simplistic and doesn't return correct MIME types for most files. Instead, this should be delegated to the host:

2) Since both files and sockets are abstractions over bytes, cljs.repl.server/send-and-close should be agnostic to file encoding and just send whatever is in the file. Currently this is handled via cljs.repl.browser/mime-type->encoding.

I will prepare a patch by tomorrow.

Environment

None

Activity

Show:
Yegor Timoshenko
December 26, 2017, 1:18 PM

Also, if you don't like something about this patch, do tell me and I'll fix it right away. I'm very interested in getting this merged.

import
April 19, 2018, 9:22 PM

Comment made by: ncg

Allow me to make a case for this as well. Although somewhat of an edge case, I spent quite some
time today figuring out why cljs.main -s wouldn't serve my WebAssembly file, when everything else worked perfectly.
Especially considering the great experience provided by the new clj tooling, having to use a separate
server for one-off experiments is somewhat annoying.

David Nolen
April 20, 2018, 12:41 AM

Can we get a rebased patch?

Yegor Timoshenko
April 20, 2018, 2:06 AM

Sure, will do by Monday.

import
April 20, 2018, 10:52 AM

Comment made by: ncg

Thank you. Please let me know if I can be of assistance.

Assignee

Yegor Timoshenko

Reporter

Yegor Timoshenko

Labels

None

Approval

None

Patch

Code

Affects versions

Priority

Major
Configure