Closed simanacci closed 1 year ago
It's an issue with your matcher - it should be:
Mock::given(method("GET"))
// We do NOT include query parameters here
.and(matchers::path("/v0/maxitem.json"))
.and(matchers::query_param("print", "pretty"))
.respond_with(template)
// [...]
If you update to wiremock
0.5.16 and run your code again, you'll get this error:
thread 'main' panicked at 'Wiremock can't match the path `/v0/maxitem.json?print=pretty` because it contains a `?`. You must use `wiremock::matchers::query_param` to match on query parameters (the part of the path after the `?`).'
which should be more helpful in nudging you in the right direction.
Code
Output
Actual result from Hacker News API https://i.imgur.com/79SJnTX.png