Skip to content

Commit

Permalink
fix(Server): mime type for wasm in contentBase directory (#1575) (#1580)
Browse files Browse the repository at this point in the history
  • Loading branch information
samsam2310 authored and evilebottnawi committed Dec 5, 2018
1 parent 7a3a257 commit fadae5d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ function Server (compiler, options = {}, _log) {
// eslint-disable-next-line
const app = this.app = new express();

// ref: https://github.com/webpack/webpack-dev-server/issues/1575
// remove this when send@^0.16.3
express.static.mime.types.wasm = 'application/wasm';

app.all('*', (req, res, next) => {
if (this.checkHost(req.headers)) {
return next();
Expand Down
14 changes: 14 additions & 0 deletions test/ContentBase.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,18 @@ describe('ContentBase', () => {
.expect(404, done);
});
});

describe('Content type', () => {
before((done) => {
server = helper.start(config, {
contentBase: [contentBasePublic]
}, done);
req = request(server.app);
});

it('Request foo.wasm', (done) => {
req.get('/foo.wasm')
.expect('Content-Type', 'application/wasm', done);
});
});
});
Empty file.

0 comments on commit fadae5d

Please sign in to comment.