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

[Feature Request] fakeServer.respondWith(customMatcherFunction, response); #2318

Closed
johnmiroki opened this issue Dec 9, 2020 · 2 comments
Closed

Comments

@johnmiroki
Copy link

johnmiroki commented Dec 9, 2020

Currently, to make a mock data server:

var server = sinon.createFakeServer([config]);
server.respondWith(urlRegExp, response);

It works but regular expression can be tricky. I hope FakeServer supports:

fakeServer.respondWith(customMatcherFunction, response);

function customMatcherFunction(url) {

    return url.endsWith("xxx");
}

Could you please consider this? Really appreciate it!

@johnmiroki johnmiroki changed the title [Function Request] fakeServer.respondWith(customMatcherFunction, response); [Feature Request] fakeServer.respondWith(customMatcherFunction, response); Dec 9, 2020
@fatso83
Copy link
Contributor

fatso83 commented Dec 9, 2020

A feature requests in the form of a pull request is the only way this will happen, I'm afraid :)

@fatso83
Copy link
Contributor

fatso83 commented May 25, 2021

Thanks for the PR!

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

2 participants