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

Panic if path contains ? #104

Merged
merged 3 commits into from
Dec 31, 2022

Conversation

marcoieni
Copy link
Contributor

@marcoieni marcoieni commented Oct 3, 2022

I noticed a lot of people (including me) when using wiremock often forget about query_param and put ? in the path, doing stuff like:

    Mock::given(method("GET"))
        .and(path("abcd/?letter=e"));

instead of

    Mock::given(method("GET"))
        .and(path("abcd/"))
        .and(query_param("letter","e"));

Can we validate the path with this approach?

@marcoieni marcoieni marked this pull request as ready for review October 3, 2022 14:07
@LukeMathWalker
Copy link
Owner

I'm inclined to merge this, but I am not 100% that there is no legit usage of ? in a path outside of the context of query parameters.
I'd have to check the spec.

src/matchers.rs Outdated Show resolved Hide resolved
Copy link
Owner

@LukeMathWalker LukeMathWalker left a comment

Choose a reason for hiding this comment

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

Let's go 🚀

@LukeMathWalker LukeMathWalker merged commit 8f2a457 into LukeMathWalker:main Dec 31, 2022
@LukeMathWalker
Copy link
Owner

We should probably do something similar for the path matcher - panic if they included the URL base in there.

@marcoieni
Copy link
Contributor Author

We should probably do something similar for the path matcher - panic if they included the URL base in there.

Can you open an issue where you write a piece of code as an example and assign the issue to me?
I would be happy to open a PR 😄

@LukeMathWalker
Copy link
Owner

#106 - here you go @marcoieni ❤️

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

Successfully merging this pull request may close these issues.

2 participants