Hi I am using wiremock client in kotlin (3.0.1) an...
# help
u
Hi I am using wiremock client in kotlin (3.0.1) and I want to add a stub like this:
Copy code
stubFor(
            get(urlPathEqualTo("/bulk-content"))
                .withQueryParam("contentIds", havingExactly("1", "2"))
                .willReturn(
                aResponse()
                    .withStatus(200)
                    .withHeader(CONTENT_TYPE, APPLICATION_JSON)
                    .withBody(mock)
            )
        )
but I am getting this error :
Copy code
com.github.tomakehurst.wiremock.common.InvalidInputException: {
  "errors" : [ {
    "code" : 10,
    "source" : {
      "pointer" : "/request/queryParameters/contentIds"
    },
    "title" : "Error parsing JSON",
    "detail" : "{\"hasExactly\":[{\"equalTo\":\"1\"},{\"equalTo\":\"2\"}]} is not a valid match operation"
  } ]
}
expected mock :
/bulk-content?contentIds=1&contentIds=2
1
r
how are you running your wiremock server?
it seems most likely that the server is running an older version of wiremock
🙌 1
u
hmmm, you can be right, I am using 2.x.x let me try with 3.6.6
thank you, it worked 🌸
r
great!
u
Is there a way to fill the havingExactly method with a list?
Copy code
.withQueryParam("contentIds", havingExactly("1", "2"))
-> this usage from documentation but 1 and 2 came from a list and it can ben 4 and 5 or 6,7,8,9... do you have any idea ?
r
you should be able to convert the list to an array and pass that to the method
u
thanks a lot 🤍
r
happy to help