Search code examples
mockingstubquery-stringstubbingwiremock

how should look url with two or more query params


I'm puzzled, how should look my "urlPathPattern" when using two or more query params

My code:

"request": {
"method": "POST",
"urlPathPattern": "/cashboxes/{cashbox_id}/registration/{registration_id}",
"queryParameters": {
  "cashbox_id": {
    "equalTo": "1"
  }
}

how url should look like:

POST
http://BaseUrl/cashboxes/1/registration/1

I understand that it don't work. Tell me, how fix my urlPathPattern


Solution

  • urlPathPattern takes regular expressions, not URL templates.

    Try something like: /cashboxes/[0-9]+/registration/[0-9]+