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

feat(core): Support custom functions in matchRequestsBy config options #138

Merged
merged 4 commits into from
Nov 24, 2018

Conversation

offirgolan
Copy link
Collaborator

@offirgolan offirgolan commented Nov 19, 2018

Resolved #136.

Add more fine grain control on how request ids are generated by allowing custom methods to be passed into the matchRequestsBy config options.

@offirgolan offirgolan added enhancement ✨ New feature or request 📦 core labels Nov 19, 2018
@@ -205,12 +198,16 @@ export default class PollyRequest extends HTTPBase {
keys(NormalizeRequest).forEach(key => {
if (this[key] && matchRequestsBy[key]) {
identifiers[key] = NormalizeRequest[key](
key === 'body' ? this.serializedBody : this[key],
this[key],
Copy link
Collaborator Author

@offirgolan offirgolan Nov 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pass the actual request body into the normalizer. We will serialize the returned body after.

@offirgolan offirgolan merged commit 626a84c into master Nov 24, 2018
@offirgolan offirgolan deleted the match-requests-by-custom-fn branch November 24, 2018 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ✨ New feature or request 📦 core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants