nl_tokens: Set up some event magic . The precedence is given first to status - specific handlers then to responses for a given event and then finally to the more general response handler . In the last case we need to first make sure we re not dealing with a a redirect .
pl_tokens: function ( event ) { var emitter = request . emitter ; var textStatus = STATUS_CODES [ response . status ] ? STATUS_CODES [ response . status ] . toLowerCase ( ) : null ; if ( emitter . listeners ( <mask> . status ) . length > 0 || emitter . listeners ( textStatus ) . length > 0 ) { emitter . emit ( response . status , response ) ; emitter . emit ( textStatus , response ) ; } else { if ( emitter . listeners ( event ) . length > 0 ) { emitter . emit ( event , response ) ; } else if ( ! response . isRedirect ) { emitter . emit ( "response" , response ) ; //console.warn("Request has no event listener for status code " + response.status); } } }