File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,7 +36,12 @@ const WebpackDevServerPlugin: Hapi.Plugin<WebpackDevServerPluginOptions> & Hapi.
3636 // webpack-dev-middleware never calls the callback with an err object.
3737 // See node_modules/webpack-dev-middleware/lib/middleware.js.
3838 } ) ;
39- return h . continue ;
39+ // Hapi doesn't seem to honor h.abandon, leading to "headers already sent"
40+ // errors on the console. Mark the private property _isReplied as true so
41+ // that Hapi doesn't send anything.
42+ // https://github.com/hapijs/hapi/issues/3884
43+ ( request as any ) . _isReplied = request . raw . res . finished ;
44+ return request . raw . res . finished ? h . abandon : h . continue ;
4045 } catch ( err ) {
4146 return err ;
4247 }
@@ -53,7 +58,8 @@ const WebpackDevServerPlugin: Hapi.Plugin<WebpackDevServerPluginOptions> & Hapi.
5358 }
5459 } ) ;
5560 } ) ;
56- return h . continue ;
61+ ( request as any ) . _isReplied = request . raw . res . finished ;
62+ return request . raw . res . finished ? h . abandon : h . continue ;
5763 } catch ( err ) {
5864 return err ;
5965 }
You can’t perform that action at this time.
0 commit comments