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

Documentation: Stubbing a request with any query #693

Closed
joallard opened this issue Mar 9, 2017 · 4 comments
Closed

Documentation: Stubbing a request with any query #693

joallard opened this issue Mar 9, 2017 · 4 comments

Comments

@joallard
Copy link

joallard commented Mar 9, 2017

I haven't found how to do this in the examples, so I'm filing this as a documentation issue.

How do I stub a request to a particular URL ("example.com/a/b"), not caring about the query string?

If I only stub the URL, it doesn't hit the stub.

@bblimke
Copy link
Owner

bblimke commented Mar 9, 2017

How about regular expression?
https://github.com/bblimke/webmock#matching-uris-using-regular-expressions

@joallard
Copy link
Author

joallard commented Mar 9, 2017

That's how I worked around it. I thought there'd be a first class way to do this, okay then

@joallard joallard closed this as completed Mar 9, 2017
@bblimke
Copy link
Owner

bblimke commented Mar 9, 2017

@joallard alternatively .with(query: hash_including({}) but it's also a workaround.

WebMock treats query as part of the url (well, it is), therefore if it's empty, it expects it to be empty.
Perhaps that should be changed in the future.

@joallard
Copy link
Author

Thanks @bblimke !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants