Closed jayvdb closed 1 year ago
Thanks for reaching out! Cool that you use httpmock
in progenitor, which sounds like a very interesting use case.
Did you see there is the following function that allows you to set a custom port: https://github.com/alexliesenfeld/httpmock/blob/d25bac2f2d615cfc36c3ea79eac4054f9644d9dc/tests/lib.rs#L23
The following test shows you how you can use it with the httpmock
client:
https://github.com/alexliesenfeld/httpmock/blob/d25bac2f2d615cfc36c3ea79eac4054f9644d9dc/tests/examples/standalone_tests.rs#L12-L20
@jayvdb Is this sufficient for your use case?
This issue is stale because it has been open for 30 days with no activity.
https://github.com/oxidecomputer/progenitor recently added the ability to generate httpmock's for an OpenAPI spec. This is great for testing.
However it would also make it quite easy to build a reasonable mock service that can be used instead of a "real" service. The only problem is that
httpmock
cant be told which port to use. Well, it can, but only from within the crate, which is what thestandalone
feature uses.It would be nice if
server::start_server
was public outside the crate, so I could build my own "standalone", using my generated openapi mocks and some custom code to return appropriate responses.However any other mechanism for being able to start the mock server at a specified port would likely be sufficient for my purpose.