alexliesenfeld / httpmock

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

Remove http client #90

Closed alexliesenfeld closed 8 months ago

alexliesenfeld commented 8 months ago

When httpmock is used as a library only (not for connecting to a remote mock server using MockServer::connect and the like), we can eliminate the need for a real HTTP client altogether. This not only addresses the TLS issues but also reduces the dependency tree by approximately 60 crates!

Some users reported they also use httpmock as a standalone mock server behind proxies and other infrastructure (like Kubernetes), which may be SSL-enabled. This still requires a real HTTP client i.m.o. For this scenario, I want to hold off until the isahc upstream PR gets merged, as my experience with isahc has been very positive so far. However, to opt into using isahc, users need to enable the “remote” feature flag, which will only be used to connect to remote mock servers. As a consequence, functions like MockServer::connect, MockServer::connect_async, and MockServer::connect_env will only be available when the “remote” feature is turned on.

This represents a breaking change.

Fixes https://github.com/alexliesenfeld/httpmock/issues/82.

codecov[bot] commented 8 months ago

Codecov Report

Attention: 8 lines in your changes are missing coverage. Please review.

Comparison is base (ce8a5e4) 79.79% compared to head (29eda3d) 72.69%.

:exclamation: Current head 29eda3d differs from pull request most recent head cde1cca. Consider uploading reports for the commit cde1cca to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #90 +/- ## ========================================== - Coverage 79.79% 72.69% -7.10% ========================================== Files 19 20 +1 Lines 1336 1366 +30 ========================================== - Hits 1066 993 -73 - Misses 270 373 +103 ``` | [Files](https://app.codecov.io/gh/alexliesenfeld/httpmock/pull/90?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Liesenfeld) | Coverage Δ | | |---|---|---| | [src/api/adapter/mod.rs](https://app.codecov.io/gh/alexliesenfeld/httpmock/pull/90?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Liesenfeld#diff-c3JjL2FwaS9hZGFwdGVyL21vZC5ycw==) | `40.00% <ø> (-24.87%)` | :arrow_down: | | [src/api/server.rs](https://app.codecov.io/gh/alexliesenfeld/httpmock/pull/90?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Liesenfeld#diff-c3JjL2FwaS9zZXJ2ZXIucnM=) | `93.54% <ø> (ø)` | | | [src/server/mod.rs](https://app.codecov.io/gh/alexliesenfeld/httpmock/pull/90?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Liesenfeld#diff-c3JjL3NlcnZlci9tb2QucnM=) | `83.89% <100.00%> (ø)` | | | [src/api/adapter/local.rs](https://app.codecov.io/gh/alexliesenfeld/httpmock/pull/90?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Liesenfeld#diff-c3JjL2FwaS9hZGFwdGVyL2xvY2FsLnJz) | `82.22% <77.77%> (-3.99%)` | :arrow_down: | | [src/api/adapter/standalone.rs](https://app.codecov.io/gh/alexliesenfeld/httpmock/pull/90?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Liesenfeld#diff-c3JjL2FwaS9hZGFwdGVyL3N0YW5kYWxvbmUucnM=) | `70.00% <81.81%> (+2.65%)` | :arrow_up: | ... and [7 files with indirect coverage changes](https://app.codecov.io/gh/alexliesenfeld/httpmock/pull/90/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Liesenfeld)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.