nickel-org / nickel.rs

An expressjs inspired web framework for Rust

Home Page:http://nickel-org.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

application/wasm header not getting set correctly

vitiral opened this issue · comments

I'm getting issues like this and I believe it is because I'm using nickel for serving my webapp

Error loading Rust wasm module 'artifact_frontend': TypeError: Failed to execute 'compile' on 'WebAssembly': Incorrect response MIME type. Expected 'application/wasm'.
(index):1 Uncaught (in promise) TypeError: Failed to execute 'compile' on 'WebAssembly': Incorrect response MIME type. Expected 'application/wasm'.

I am using nickel's server.utilize(StaticFilesHandler::new(...)) API. My guess is that it does not set the header for .wasm files correctly.

Yes, chasing through the code, it appears we need to add an entry to mimes.rs,

I've added the mime type to the tip of master. Is it possible for you to test against the nickel repository? I'm not currently working with WASM. If it works for you, I'll push a new version to crates.io.

works great, thanks so much!

gotham uses the guess_mime crate, alpha version:

# Using alpha version of mime_guess until mime crate stabilizes (releases 1.0).
# see https://github.com/hyperium/mime/issues/52
mime_guess = "2.0.0-alpha.6"

It's up to you whether you want to do that 😄

I just pushed 0.10.2 to crates.io, so you can point to that now.