@@ -113,7 +113,8 @@ describe('Hapi interface', function() {
113113 afterEach ( function ( ) {
114114 fakeServer . removeAllListeners ( ) ;
115115 } ) ;
116- it ( 'Should call continue when a boom is emitted' , function ( done ) {
116+ it ( 'Should call continue when a boom is emitted if reply is an object' ,
117+ function ( done ) {
117118 plugin . register ( fakeServer , null , function ( ) { } ) ;
118119 fakeServer . emit ( EVENT , { response : { isBoom : true } } ,
119120 {
@@ -124,6 +125,21 @@ describe('Hapi interface', function() {
124125 }
125126 ) ;
126127 } ) ;
128+ it ( 'Should call continue when a boom is emitted if reply is a function' ,
129+ function ( done ) {
130+ // Manually testing has shown that in actual usage the `reply` object
131+ // provided to listeners of the `onPreResponse` event can be a function
132+ // that has a `continue` property that is a function.
133+ // If `reply.continue()` is not invoked in this situation, the Hapi
134+ // app will become unresponsive.
135+ plugin . register ( fakeServer , null , function ( ) { } ) ;
136+ var reply = function ( ) { } ;
137+ reply . continue = function ( ) {
138+ // The continue function should be called
139+ done ( ) ;
140+ } ;
141+ fakeServer . emit ( EVENT , { response : { isBoom : true } } , reply ) ;
142+ } ) ;
127143 it ( 'Should call sendError when a boom is received' , function ( done ) {
128144 var fakeClient = {
129145 sendError : function ( err ) {
0 commit comments