-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Stop returning 500s for unmatched path patterns #2339
Conversation
src/test/java/com/github/tomakehurst/wiremock/verification/diff/DiffTest.java
Outdated
Show resolved
Hide resolved
ANY | ANY | ||
/thing | /thing | ||
| | ||
$.accountNum [equalTo] 1234 | Warning: JSON path expression '$.accountNum' failed to<<<<< Body does not match |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like here, on the Request side it should just say (empty)
rather than rendering an error message. We shouldn't really treat it as an error as when scanning a whole set of stubs matching a request with an empty body it's perfectly legit to test it against a stub that requires one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK - I've reworked it so the diff rendered outputs no body if there is no body, and the body itself if the expression does not match, which seems to be the standard way.
cf5a14c
to
7f18f53
Compare
The Diff rendering did not handle the `SubExpressionException` thrown in e.g. `MatchesJsonPathPattern`. This makes it catch that exception and output a useful value in the diff.
7f18f53
to
e95a0de
Compare
Is it a regression @Mahoney ? |
Yes, looks like it is a regression Not sure since when... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I think it does not matter too much for such an old one
It's actually quite nasty - if you create a stub using this matcher, you get a 500 for any request that doesn't match a stub instead of a 404 with a nice diff. |
I am +1 for landing it in 3.0.1
…On Wed, Aug 30, 2023 at 7:25 PM Robert Elliot ***@***.***> wrote:
It's actually quite nasty - if you create a stub using this matcher, you
get a 500 for any request that doesn't match a stub instead of a 404 with a
nice diff.
—
Reply to this email directly, view it on GitHub
<#2339 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAW4RIG73QLYEJ4Y2PZ3WXTXX5ZQPANCNFSM6AAAAAA4EE3U2A>
.
You are receiving this because your review was requested.Message ID:
***@***.***>
|
The Diff rendering did not handle the
SubExpressionException
thrown ine.g.
MatchesJsonPathPattern
. This makes it catch that exception andoutput it in the diff.
References
Reinstates #2336 after revert in #2338
Submitter checklist
#help-contributing
or a project-specific channel like#wiremock-java