You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adding matcher for property existence/non-existence (#42)
- corrected handling of all matchers using numbers: a non-numeric value
will now result in a non-match (no error logs will be posted as they
might be plenty based on the stubs that are configured)
<!-- Please describe your pull request here. -->
## References
- TODO
<!-- References to relevant GitHub issues and pull requests, esp.
upstream and downstream changes -->
## Submitter checklist
- [ ] Recommended: Join [WireMock Slack](https://slack.wiremock.org/) to
get any help in `#help-contributing` or a project-specific channel like
`#wiremock-java`
- [ ] The PR request is well described and justified, including the body
and the references
- [ ] The PR title represents the desired changelog entry
- [ ] The repository's code style is followed (see the contributing
guide)
- [ ] Test coverage that demonstrates that the change works as expected
- [ ] For new features, there's necessary documentation in this pull
request or in a subsequent PR to
[wiremock.org](https://github.com/wiremock/wiremock.org)
<!--
Put an `x` into the [ ] to show you have filled the information.
The template comes from
https://github.com/wiremock/.github/blob/main/.github/pull_request_template.md
You can override it by creating .github/pull_request_template.md in your
own repository
-->
Copy file name to clipboardExpand all lines: README.md
+32-2Lines changed: 32 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -617,6 +617,36 @@ behavior for requests with and without a matching context. The parameter support
617
617
}
618
618
```
619
619
620
+
### Property existence match
621
+
622
+
In addition to the existence of a context, you can check for the existence or absence of a property
623
+
within that context. The following matchers are available:
624
+
625
+
-`hasProperty`
626
+
-`hasNotProperty`
627
+
628
+
As for other matchers, templating is supported.
629
+
630
+
```json
631
+
{
632
+
"request": {
633
+
"method": "GET",
634
+
"urlPattern": "/test/[^\/]+/[^\/]+",
635
+
"customMatcher": {
636
+
"name": "state-matcher",
637
+
"parameters": {
638
+
"hasContext": "{{request.pathSegments.[1]}}",
639
+
"hasProperty": "{{request.pathSegments.[2]}}"
640
+
}
641
+
}
642
+
},
643
+
"response": {
644
+
"status": 200
645
+
}
646
+
}
647
+
```
648
+
649
+
620
650
### Context update count match
621
651
622
652
Whenever the serve event listener `recordState` is processed, the internal context update counter is increased. The number can be used
@@ -626,7 +656,7 @@ for request matching as well. The following matchers are available:
626
656
-`updateCountLessThan`
627
657
-`updateCountMoreThan`
628
658
629
-
As for other matchers, templating is supported.
659
+
As for other matchers, templating is supported. In case the provided value for this check is not numeric, it is handled as non-matching. No error will be reported or logged.
630
660
631
661
```json
632
662
{
@@ -656,7 +686,7 @@ for request matching as well. The following matchers are available:
656
686
-`listSizeLessThan`
657
687
-`listSizeMoreThan`
658
688
659
-
As for other matchers, templating is supported.
689
+
As for other matchers, templating is supported. In case the provided value for this check is not numeric, it is handled as non-matching. No error will be reported or logged.
0 commit comments