Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isAcceptableStatusCode #25

Closed
FGRibreau opened this issue Mar 9, 2014 · 1 comment
Closed

isAcceptableStatusCode #25

FGRibreau opened this issue Mar 9, 2014 · 1 comment

Comments

@FGRibreau
Copy link
Contributor

// There is no good reason to send an event to Keen.IO if it's for an invalid response.
// The rule is: if the app wouldn't handle a request, the middleware shouldn't handle it either.
KeenioMiddleware.prototype.isAcceptableStatusCode = function (statusCode) {
  var whitelistCodes = [401, 402, 404],
      firstCharacter = String(statusCode).charAt(0);
  return firstCharacter !== '5' && firstCharacter !== '4' || whitelistCodes.indexOf(statusCode) !== -1;
};

... but what if the developers wants to track api errors with keenio ? (that's was what I was looking for). I think it should be configurable as well :).

workaround

var keenio = require('express-keenio');
keenio.constructor.prototype.isAcceptableStatusCode = function(){
  return true;
};
@sebinsua
Copy link
Owner

Okay.

I think I'll add a switch for this in the configuration.

sebinsua added a commit that referenced this issue Mar 13, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants