Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The urlPathTemplate cannot match the query parameter. #2422

Closed
czwtest opened this issue Oct 7, 2023 · 1 comment
Closed

The urlPathTemplate cannot match the query parameter. #2422

czwtest opened this issue Oct 7, 2023 · 1 comment
Labels

Comments

@czwtest
Copy link

czwtest commented Oct 7, 2023

Proposal

I created a stub using the urlPathTemplate: “/contract/app/{pid}/api/{id}/overview”. When I made a request using the path: “/contract/app/1699603961400320001/api/1709863759148662785/overview”, the response was successful. However, when I added a query parameter and used the path: “/contract/app/1699603961400320001/api/1709863759148662785/overview?arg=2” to request, an error occurred with the message: “Path parameter does not match”.

Reproduction steps

first: the response was successful.
url path:/contract/app/1699603961400320001/api/1709863759148662785/overview
The stub:
{
"id" : "b290dbf6-bed1-435a-b6d9-e4aac8f6035d",
"request" : {
"urlPathTemplate" : "/contract/app/{pid}/api/{id}/overview",
"method" : "GET",
"headers" : {
"accept" : {
"equalTo" : "application/json",
"caseInsensitive" : true
}
},
"pathParameters" : {
"pid" : {
"equalTo" : "1699603961400320001",
"caseInsensitive" : true
},
"id" : {
"equalTo" : "1709863759148662785",
"caseInsensitive" : true
}
},
"queryParameters" : {
"arg" : {
"equalTo" : "2",
"caseInsensitive" : true
}
}
},
"response" : {
"status" : 200,
"body" : "{\r\n "code": 300,\r\n "data": true,\r\n "msg": "success"\r\n}",
"headers" : {
"content-type" : "application/json"
}
},
"uuid" : "b290dbf6-bed1-435a-b6d9-e4aac8f6035d",
"persistent" : true,
"insertionIndex" : 1
}
second: an error occurred with the message: “Path parameter does not match”:
url path:/contract/app/1699603961400320001/api/1709863759148662785/overview?arg=2
the stub:
{
"id" : "b290dbf6-bed1-435a-b6d9-e4aac8f6035d",
"request" : {
"urlPathTemplate" : "/contract/app/{pid}/api/{id}/overview",
"method" : "GET",
"headers" : {
"accept" : {
"equalTo" : "application/json",
"caseInsensitive" : true
}
},
"pathParameters" : {
"pid" : {
"equalTo" : "1699603961400320001",
"caseInsensitive" : true
},
"id" : {
"equalTo" : "1709863759148662785",
"caseInsensitive" : true
}
},
},
"response" : {
"status" : 200,
"body" : "{\r\n "code": 300,\r\n "data": true,\r\n "msg": "success"\r\n}",
"headers" : {
"content-type" : "application/json"
}
},
"uuid" : "b290dbf6-bed1-435a-b6d9-e4aac8f6035d",
"persistent" : true,
"insertionIndex" : 1
}

The error:
image

References

No response

@oleg-nenashev
Copy link
Member

I think it is quite as-designed, but not 100% sure what should be the default behavior (now it is same as absent but should be any matcher which seems to be missing for form parameters at all). I also created wiremock/wiremock.org#206 to have such a case explicitly documented

tomakehurst added a commit that referenced this issue Oct 9, 2023
Fixed #2422 - URL not matched by path template when query parameter present in request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants