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

add a route level config option to skip yar processing #90

Merged
merged 4 commits into from Jan 5, 2016
Merged

Conversation

@mark-bradshaw
Copy link
Contributor

mark-bradshaw commented Jan 5, 2016

There was a PR #69 that was abandoned along the way, but I believe it provides a useful addition. I've recreated the functionality. This PR allows you to add a route level skip option to prevent yar from processing requests to particular endpoints. This skips the overhead of session cookie creation and tracking for those requests where it would be meaningless. To skip any yar processing of a route add:

config: {
  plugins: {
    yar: {
      skip: true
    }
  }
}
@mark-bradshaw mark-bradshaw mentioned this pull request Jan 5, 2016
@mark-bradshaw mark-bradshaw self-assigned this Jan 5, 2016
@mark-bradshaw mark-bradshaw added this to the 6.1.0 milestone Jan 5, 2016
@mark-bradshaw

This comment has been minimized.

Copy link
Contributor Author

mark-bradshaw commented Jan 5, 2016

@devinivy Since you were so kind to code review the last PR, would you mind taking a quick peek at this one as well?

@devinivy

This comment has been minimized.

Copy link
Member

devinivy commented Jan 5, 2016

Looks good to me, @mark-bradshaw!

@devinivy

This comment has been minimized.

Copy link
Member

devinivy commented Jan 5, 2016

I guess I have one very minor comment–
Is any reason you require strict equality to true? Some day someone might complain that they wrote skip: 1, yar didn't yell at them, and they still got a decorated request object. I don't think this is a huge deal, really. However, I don't think it's consistent with how other boolean options are treated in the plugin (like errorOnCacheNotReady).

By the way, I like this feature! :)

@mark-bradshaw

This comment has been minimized.

Copy link
Contributor Author

mark-bradshaw commented Jan 5, 2016

No, you're right. Personally I like using explicit booleans rather than truthiness, but I think it's preferable to keep the config handling the same and allow truthiness. Good catch.

@devinivy

This comment has been minimized.

Copy link
Member

devinivy commented Jan 5, 2016

👍 👌

mark-bradshaw added a commit that referenced this pull request Jan 5, 2016
add a route level config option to skip yar processing
@mark-bradshaw mark-bradshaw merged commit 19c3717 into master Jan 5, 2016
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@mark-bradshaw mark-bradshaw deleted the skip branch Jan 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.