Skip to content
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

application/wasm header not getting set correctly #431

Closed
vitiral opened this issue Nov 1, 2018 · 4 comments
Closed

application/wasm header not getting set correctly #431

vitiral opened this issue Nov 1, 2018 · 4 comments

Comments

@vitiral
Copy link

vitiral commented Nov 1, 2018

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.

@jolhoeft
Copy link
Member

jolhoeft commented Nov 2, 2018

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

@jolhoeft
Copy link
Member

jolhoeft commented Nov 2, 2018

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.

@vitiral
Copy link
Author

vitiral commented Nov 2, 2018

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 😄

@jolhoeft
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants