Hi All, I am trying to implement, #lte in one of ...
# help
p
Hi All, I am trying to implement, #lte in one of the scenario, where the when a query parameter goes beyond a certain value, a particualr parameter should not reflect in the response. {{#lte (math request.query.$id '+' 0) 1000}} "print": "hello" {{/lte}}, Intention is that "print": "hello" should show in response when $id is <=1000, where $id is being taken as an input from the query parameter like http://example.com?$id=1001 is there anything I am missing, as all the cases it is printing "print": "hello"
r
that response template works for me. can you paste the entire stub as json?
p
@Rafe Arnold Here is the complete json response: { "@odata.sec": "https://example.com/requireddata", "@odata.count": {{request.query.$id}}, {{#lte (math request.query.$id '+' 0) 1000}} "@odata.sec2": "https://example.com/requireddata?$id={{request.query.$id}}&$skiptoken={{math request.query.$id '+' 1}}" {{/lte}}, "value": [ {{#each (range 1 (math request.query.$id '+' 0))}} { "id": "{{randomValue type='UUID'}}", "userId": "{{randomValue type='UUID'}}", "Name": "Autotest{{randomValue length=1 type='NUMERIC'}}", } {{#unless @last}},{{/unless}} {{/each}} ] }
r
is the
@odata.count
field being rendered as you expect?
p
yes
r
what version of wiremock are you using?
p
latest version of docker image
r
i cant reproduce this myself
p
ok..atleast, you are confirming this is working as expected right? i mean it's implemented in correct way?
r
yes it's working for me
p
ok..thank you!!, let me check if something is missed from my side
👍 1
@Rafe Arnold, thanks!! able to figure out, it was due to some regex issue in the request itself, so was picking up the wrong response file
r
glad you managed to fix it