Allow using wildcard in request URI
See original GitHub issueCurrently when using the httpserver.expect_request
function, I am only allowed to use the full URI string. It would be nice if it would also accept URI’s with wildcards or regex.
For instance, I have an endpoint called GET /users/{USER_ID}/role
that will return the role of a user with a given USER_ID. If I would like to mock this endpoint I would have to specify a httpserver.expect_request
for each of the users I am using in my tests:
httpserver.expect_request("/users/1/role").respond_with_json("admin")
httpserver.expect_request("/users/2/role").respond_with_json("admin")
httpserver.expect_request("/users/3/role").respond_with_json("admin")
It would be way more convenient if we could just pass in a wildcard instead:
httpserver.expect_request("/users/*/role").respond_with_json("admin")
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
I’ve released 0.3.5. I’m closing this issue in the hope that packages on pypi are also usable (I’ve already checked, but who knows…). 😃 If you see any problem, feel free to open a new issue.
Thanks for using this library!
I’ve merged the PR request, thanks for your comments! I think I’ll do a release later today.