Masi
09/08/2023, 6:09 PM"queryParameters": {
"fq": {
"includes": [
{
"equalTo": "(type:\"news\")"
},
{
"doesNotContain": "newsStartYear"
}
]
},
From the docs I expect that one of the fq
parameters must be equal to type:"news")
, but none of them must contain newsStartYear
.
In my tests neither doesNotContain
nor doesNotMatch
work like that. For all "positive" matchers includes
works like a logical AND, but all negative have no effect for me.
What am I doing wrong?Aaron
09/08/2023, 6:41 PMMasi
09/08/2023, 6:41 PMAaron
09/08/2023, 6:42 PMand
instead of includes
?{
"request": {
"urlPath": "/things",
"method": "GET",
"queryParameters": {
"id": {
"and": [
{
"contains": "2"
},
{
"doesNotContain": "3"
}
]
}
}
},
"response": {
"status": 200
}
}
but the following won’t even build:
{
"request": {
"urlPath": "/things",
"method": "GET",
"queryParameters": {
"id": {
"includes": [
{
"contains": "2"
},
{
"doesNotContain": "3"
}
]
}
}
},
"response": {
"status": 200
}
}
Masi
09/08/2023, 6:46 PMAaron
09/08/2023, 6:47 PM<http://www.foo.com/things?fq=1&fq=2&fq=3>
?Masi
09/08/2023, 6:49 PMfacet.field={!ex%3DfaqCategory}faqCategory&facet.field={!ex%3DnewsCategory}newsCategory&facet.field={!ex%3DpublicationCategory}publicationCategory&<http://json.nl|json.nl>=flat&f.newsCategory.facet.sort=index&fl=*,score&start=0&f.faqCategory.facet.sort=index&sort=newsStarttimeStamp+asc&fq=siteHash:"f849f0f9bbe6858353def4124139e591f8be4591"&fq={!typo3access}-1,0&fq=(type:"tx_news_domain_model_news")&fq=(newsIsEvent:"false")&fq=(newsStartYear:"2023")&rows=10&facet.limit=100&json.facet={"type":{"type":"terms","field":"type","limit":100,"mincount":1},"newsStartYear":{"type":"terms","field":"newsStartYear","limit":100,"mincount":1},"newsIsEvent":{"type":"terms","field":"newsIsEvent","limit":100,"mincount":1},"programChannel":{"type":"terms","field":"programChannel","limit":100,"mincount":1},"programType":{"type":"terms","field":"programType","limit":100,"mincount":1},"programs":{"type":"terms","field":"programPrograms","limit":100,"mincount":1,"domain":{"excludeTags":"programPrograms"}},"category":{"type":"terms","field":"category","limit":100,"mincount":1},"doktype":{"type":"terms","field":"doktype","limit":100,"mincount":1},"jobType":{"type":"terms","field":"jobType","limit":100,"mincount":1},"publicationYear":{"type":"terms","field":"publicationYear","limit":100,"mincount":1},"departments":{"type":"terms","field":"employeeDepartments","limit":100,"mincount":1,"domain":{"excludeTags":"employeeDepartments"}}}&q=*&defType=edismax&omitHeader=false&f.publicationCategory.facet.sort=index&qf=content^40.0+title^5.0+keywords^2.0+tagsH1^5.0+tagsH2H3^3.0+tagsH4H5H6^2.0+tagsInline+description^4.0+abstract+subtitle+navtitle+author&facet.mincount=1&facet=true&wt=json&facet.sort=count
fq
can appear multiple times.Aaron
09/08/2023, 6:51 PMMasi
09/08/2023, 6:53 PMAaron
09/08/2023, 6:55 PM"id": {
"and": [
{
"contains": "2"
},
{
"doesNotContain": "3"
}
]
}
and a request that is like:
<http://foo.com/?id=3&id=2>
I’ll get a match on the case where id=2
, because id
contains 2 and doesNotContain 3, even though there is that other id=3
.Masi
09/08/2023, 6:56 PMAaron
09/08/2023, 6:59 PMif
that is 😭 ), the best solution would be to write a custom matcher that parses the query parameters yourself.
https://wiremock.org/docs/extensibility/custom-matching/Masi
09/08/2023, 7:00 PMAaron
09/08/2023, 7:02 PMMasi
09/08/2023, 7:04 PMAaron
09/08/2023, 7:05 PMMasi
09/08/2023, 7:06 PMfq
.
So I can list them all in en hasExactly
matcher.Aaron
09/08/2023, 7:11 PMMasi
09/08/2023, 7:14 PM