Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

@AndersDJohnson

Description

@AndersDJohnson

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions