File tree 2 files changed +24
-1
lines changed
2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ module.exports = function wrapper(context) {
69
69
let content = context . fs . readFileSync ( filename ) ;
70
70
content = handleRangeHeaders ( content , req , res ) ;
71
71
72
- let contentType = mime . getType ( filename ) ;
72
+ let contentType = mime . getType ( filename ) || '' ;
73
73
74
74
// do not add charset to WebAssembly files, otherwise compileStreaming will fail in the client
75
75
if ( ! / \. w a s m $ / . test ( filename ) ) {
Original file line number Diff line number Diff line change @@ -219,6 +219,29 @@ describe('Server', () => {
219
219
} ) ;
220
220
} ) ;
221
221
222
+ describe ( 'no extension support' , ( ) => {
223
+ before ( ( done ) => {
224
+ app = express ( ) ;
225
+ const compiler = webpack ( webpackConfig ) ;
226
+ instance = middleware ( compiler , {
227
+ stats : 'errors-only' ,
228
+ logLevel,
229
+ index : 'noextension'
230
+ } ) ;
231
+ app . use ( instance ) ;
232
+ listen = listenShorthand ( done ) ;
233
+ instance . fileSystem . writeFileSync ( '/noextension' , 'hello' ) ;
234
+ } ) ;
235
+ after ( close ) ;
236
+
237
+ it ( 'request to noextension' , ( done ) => {
238
+ request ( app ) . get ( '/' )
239
+ . expect ( 'hello' )
240
+ . expect ( 'Content-Type' , '; charset=UTF-8' )
241
+ . expect ( 200 , done ) ;
242
+ } ) ;
243
+ } ) ;
244
+
222
245
describe ( 'custom mimeTypes' , ( ) => {
223
246
before ( ( done ) => {
224
247
app = express ( ) ;
You can’t perform that action at this time.
0 commit comments