Skip to content

Commit

Permalink
fix(Server): validate express.static.mime.types
Browse files Browse the repository at this point in the history
fixes: #1724
  • Loading branch information
hiroppy committed Apr 5, 2019
1 parent d5d60cb commit 9073cd9
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ class Server {
if (options.lazy && !options.filename) {
throw new Error("'filename' option must be set in lazy mode.");
}

// if the user enables http2, we can safely enable https
if (options.http2 && !options.https) {
options.https = true;
}

updateCompiler(compiler, options);

this.stats =
Expand Down Expand Up @@ -174,7 +174,14 @@ class Server {

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

app.all('*', (req, res, next) => {
if (this.checkHost(req.headers)) {
Expand Down

0 comments on commit 9073cd9

Please sign in to comment.