code: function restifyRequestHandler(client, config, req, res, next) {
    var listener = {};
  
    if (isObject(res) && isFunction(res.on) && isFunction(res.removeListener)) {
  
      listener = function() {
  
        restifyRequestFinishHandler(client, config, req, res);
        res.removeListener('finish', listener);
      };
  
      res.on('finish', listener);
    }
  
    return next();
  }
docs: The restifyRequestHandler attaches the restifyRequestFinishHandler to each
  responses 'finish' event wherein the callback function will determine
  whether or not the response is an error response or not. The finish event is
  used since the restify response object will not have any error information
  contained within it until the downstream request handlers have had the
  opportunity to deal with the request and create a contextually significant
  response.
  @function restifyRequestHandler
  @param {AuthClient} client - the API client
  @param {NormalizedConfigurationVariables} config - the application
  configuration
  @param {Object} req - the current request
  @param {Object} res - the current response
  @param {Function} next - the callback function to pass the request onto the
  downstream request handlers
  @returns {Any} - the result of the next function