alexliesenfeld / httpmock

HTTP mocking library for Rust.
MIT License
435 stars 40 forks source link

feat: allow user to specify shutdown signal #77

Closed sdbondi closed 1 year ago

sdbondi commented 1 year ago

Thanks for the crate :)

When using it as a library, ctrl+c/SIGHUP has no effect because it is handled here. The mockserver exiting does not necessarily mean our application should end (using this as part of cucumber tests). This PR allows the user to specify their own shutdown signal / std::future::pending if not needed. Moved the handlers to the main when running standalone.

alexliesenfeld commented 1 year ago

Thanks! Looks interesting. I will have a deeper look into it and get back to you with some feedback soon!

alexliesenfeld commented 1 year ago

Thanks for this PR!

Just for clarification: Are you using httmock in standalone mode?

sdbondi commented 1 year ago

@alexliesenfeld No problem - thanks for the review and merge :)

Just for clarification: Are you using httmock in standalone mode?

Yes, we're using the standalone server in cucumber tests with our own shutdown signal that satisfies the Future<()> trait. A SIGINT can just exit non-gracefully