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(fetch)!: match request as function #587

Open
AndersDJohnson opened this issue Jan 29, 2020 · 0 comments
Open

feat(fetch)!: match request as function #587

AndersDJohnson opened this issue Jan 29, 2020 · 0 comments

Comments

@AndersDJohnson
Copy link
Member

AndersDJohnson commented Jan 29, 2020

Right now we support match as a function but it only operates on the path. Might be cool to switch that (or otherwise support) matching on the whole request summary object ({ url, query } etc.):

mockyeah.get(req => req.url === '/service/exists' && req.query.name === 'me');

This could enable more complex matching logic that depends on different parts of the request to cohere, or conditionally matches some parts of the request based on others.

It would be cool if you could either return explicit boolean true/false, or else either throw or return undefined, similar to how existing match functions work inside match-deep - maybe we would use match-deep to process internally, just pass it the request summary object instead of only the url.

Relates to #441.

@AndersDJohnson AndersDJohnson changed the title feat: match as function feat: match request as function Jan 29, 2020
@AndersDJohnson AndersDJohnson changed the title feat: match request as function feat(fetch): match request as function Jan 29, 2020
@AndersDJohnson AndersDJohnson changed the title feat(fetch): match request as function feat(fetch)!: match request as function Apr 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant