Skip to content

Update Rust crate httpmock to 0.9.0 - #316

Merged
fajinyuan merged 2 commits into
mainfrom
renovate/httpmock-0.x
Oct 21, 2026
Merged

fajinyuan merged 2 commits into
mainfrom
renovate/httpmock-0.x

Conversation

@renovate

@renovate renovate Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

This PR contains the following updates:

Package Type Update Change
httpmock dev-dependencies minor 0.8.0 → 0.9.0

Release Notes

httpmock/httpmock (httpmock)

v0.9.0

Compare Source

The crate was upgraded to the Rust 2024 edition. The minimum supported Rust version
remains 1.88.

Breaking changes
  • server::matchers is now crate-private
    (#​312). Its matcher, comparator and reader
    types are implementation details rather than a supported extension API; there is no
    replacement public path. Custom predicates remain possible with When::is_true.
  • The body helpers is_blank, contains_str, contains_slice and contains_vec
    were removed (#​246). Use
    request.body_string().contains(".."), which also works inside respond_with, or
    request.body_ref().windows(n).any(|w| w == b"..") with a non-empty needle, and
    When::body_includes when matching.
  • HttpMockRequest::query_params_map() was removed
    (#​246). Collect query_params() instead:
    let params: HashMap<String, String> = request.query_params().into_iter().collect();
    keeps the last value for duplicate keys, as the removed method did. query_params() has
    returned Vec<(String, String)> since 0.8.2.
  • The MockExt trait was removed and Mock's public id field is now private
    (#​285). Remove MockExt imports and
    replace direct mock.id field access with mock.id(). Mock::new(id, &server) is
    unchanged.
  • The mock server only accepts cleartext HTTP/2 connections (prior knowledge, as gRPC clients
    send it) when the http2 cargo feature is enabled
    (#​297). Previously this worked without the
    feature. It fails at runtime, not at compile time: the client sees the connection closed
    after the preface and the server logs "invalid HTTP version parsed (found HTTP2 preface)".
    Enable http2 to keep serving such clients; standalone and the Docker image already
    include it. HTTPS via ALPN is unaffected, as h2 was already only offered with the feature
    enabled. The crate also no longer enables tokio/signal or hyper/http2 for other crates
    in the build, so a crate that relied on that has to enable them itself.
  • server::state::MockServerState and server::state::HttpMockStateManager are now
    crate-private (#​289,
    #​326). Neither could be used from outside
    the crate beyond constructing it; code using the MockServer API is unaffected.
  • The empty experimental Cargo feature was removed
    (#​316). Remove it from your dependency's
    feature list; it did not enable any functionality.
  • The Docker image now uses a slim Debian runtime without the Rust toolchain or source tree
    (#​202,
    1231c63). curl and wget are no
    longer installed, so healthchecks that call them need another probe: an httpGet probe
    against /__httpmock__/ping, or from inside the container
    bash -c 'exec 3<>/dev/tcp/127.0.0.1/5050'. The CA files are no longer in the image either;
    use certs/ca.pem from the repository or server::DEFAULT_CA_CERTIFICATE. The executable
    is now at /usr/local/bin/httpmock, with a compatibility symlink at
    /usr/local/cargo/bin/httpmock so existing absolute paths continue to work.
  • The tls-detect cargo feature was removed
    (#​333). It only enabled an internal
    dependency that https already pulled in; remove it from your feature list.
  • Optional dependencies no longer double as cargo features: clap, colored, headers,
    hyper-rustls, if-addrs, rcgen, rustls, rustls-pki-types, serde_yaml,
    tokio-rustls and tracing-subscriber are enabled through the documented features only.
    Replace any of these names in your feature list with the feature that needs them, such as
    https or standalone.
  • RecordingRuleBuilder::config is now private
    (#​322). Its type could only be used through
    type inference; configure recordings through the builder's methods.
Upgrading from 0.8

Most code needs no changes. Remove MockExt imports and use mock.id() to read a mock's
ID. Replace body().is_blank() with body_string().trim().is_empty() and
body().contains_str("x") with body_string().contains("x"). Replace query_params_map()
with query_params().into_iter().collect::<HashMap<_, _>>().

Direct imports from server::matchers must be removed; use the When API to configure
matchers instead.

Tests whose clients speak cleartext HTTP/2 to the mock server additionally need the http2
feature.

The methods deprecated since 0.8.0 (Mock::hits, hits_async, assert_hits,
assert_hits_async and When::matches) are still available and will be removed in 1.0.

Improvements
  • #​326: Add HttpMockResponse::to_http_response()
    for converting to an HTTP response with a byte body. The method borrows the response and
    returns any conversion error.
  • #​108: Mocks can be limited to a number of
    calls with Then::up_to_n_times, Mock::up_to_n_times or Mock::up_to_n_times_async,
    after which they stop matching requests. Static mock YAML files support the same limit as
    up_to_n_times under then. MockServer::reset(), which start() and connect() call,
    now also resets the call counters of static YAML mocks. (resolves
    #​96)
    (thanks @​wfchandler)
  • Async mock, forwarding, proxy and recording setup futures implement Send when their
    inputs do, allowing registration inside tokio::spawn
    (#​325).
  • When, Then and the forwarding, proxy and recording rule builders are now Send and
    Sync (#​322).
  • #​297: httpmock's own dependency tree is about
    30% smaller (74 to 52 crates without default features, 86 to 64 with them), resolving
    #​46
  • #​333: async-trait and tls-detect are no
    longer dependencies. The server now tells TLS and plain HTTP connections apart by the first
    byte the client sends.
  • #​275: Owned HTTP request and response
    conversions avoid unnecessary body clones.
  • #​299: Static mock YAML files now support
    json_body and body_from_file (resolves issues
    #​118 and
    #​185)
  • #​251: The default CA certificate and key are
    exposed for testing as server::DEFAULT_CA_CERTIFICATE and server::DEFAULT_CA_PRIVATE_KEY
    (https feature) (thanks @​ErikMcClure)
  • #​298: The case-sensitive body matching
    introduced in v0.8.0 is now documented
Bug fixes
  • HttpMockServerBuilder::build() returns an error instead of panicking when the directory
    of static mock files cannot be listed, and the YAML and file error messages were reworded
    (904fc03)
  • Two error messages of the admin API changed: static mocks now report "cannot be modified or
    deleted" and failed state operations "state operation failed: ...". Only clients that match
    on the response body of a failed request can notice
  • The http2 feature now also enables HTTP/2 in the HTTPS client, so remote, https and
    http2 compile together without remote-https
  • #​229: The https feature builds correctly
    again (hyper-rustls/ring is enabled) (thanks @​danieleades)
  • #​242,
    #​326: Server TLS falls back to ring when no
    rustls crypto provider is installed, instead of panicking when several providers are compiled
    in (thanks @​danieleades)
  • #​243: DELETE /recordings/:id now deletes
    recordings instead of proxy rules (thanks @​danieleades)
  • #​245: The configured history_limit is
    honored instead of a hardcoded cap (thanks @​danieleades)
  • The *_prefix and *_suffix matchers no longer panic with a char-boundary error when
    building a mismatch report for a request value containing multi-byte UTF-8 characters
  • #​315: Mismatch reports print request and mock
    values containing tab characters (e.g. TSV bodies) verbatim instead of re-aligning them into
    columns
  • #​318: Recording::save and save_to no longer
    overwrite a recording saved under the same scenario name in the same second; the second file
    gets a counter suffix
    (<scenario>_<timestamp>_1.yaml)
Internal improvements and CI
Dependency updates
  • #​212: "Bump the npm_and_yarn group across 1 directory with 16 updates"
  • #​221: "ci(deps): bump docker/build-push-action from 6 to 7"
  • #​222: "ci(deps): bump docker/login-action from 3 to 4"
  • #​223: "ci(deps): bump withastro/action from 5 to 6"
  • #​225: "ci(deps): bump actions/deploy-pages from 4 to 5"
  • #​239: "ci(deps): bump codecov/codecov-action from 5 to 7"
  • #​240: "ci(deps): bump actions/checkout from 6 to 7"
  • #​253: "ci(deps): bump the npm_and_yarn group across 1 directory with 2 updates"
  • #​255: "ci(deps): bump taiki-e/install-action from 2 to 2.85.5"
  • #​256: "ci(deps): bump the npm_and_yarn group across 1 directory with 3 updates"
  • #​272: "ci(deps): bump js-yaml from 4.3.0 to 4.3.1 in /docs/website"
  • #​294: "ci(deps): bump taiki-e/install-action from 2.85.5 to 2.86.5"
  • #​295: "ci(deps): bump taiki-e/install-action from 2.86.5 to 2.87.0"
  • #​302: "ci(deps): bump fast-uri from 3.1.5 to 3.1.7 in /docs/website"
  • #​307: "ci(deps): bump svgo from 4.0.2 to 4.1.0 in /docs/website"
  • #​308: "ci(deps): bump taiki-e/install-action from 2.87.0 to 2.87.11"
  • #​309: "ci(deps): bump actions-rust-lang/setup-rust-toolchain from 1 to 2"
  • #​310: "ci(deps): bump the npm_and_yarn group across 1 directory with 5 updates"
  • #​313: "ci(deps): bump actions-rust-lang/setup-rust-toolchain from 1 to 2"
  • #​314: "ci(deps): bump taiki-e/install-action from 2.87.11 to 2.87.15"
  • #​319: "ci(deps): bump taiki-e/install-action from 2.87.15 to 2.87.20"
  • #​327: "ci(deps): bump taiki-e/install-action from 2.87.20 to 2.87.22"
  • #​330: "ci(deps): bump the npm_and_yarn group across 1 directory with 2 updates"

Configuration

📅 Schedule: (UTC)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@codecov

codecov Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.34%. Comparing base (1c5319a) to head (78b1526).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #316   +/-   ##
=======================================
  Coverage   79.34%   79.34%           
=======================================
  Files          13       13           
  Lines        2116     2116           
=======================================
  Hits         1679     1679           
  Misses        437      437           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fajinyuan
fajinyuan added this pull request to the merge queue Oct 21, 2026
Merged via the queue into main with commit b2fbab6 Oct 21, 2026
8 checks passed
@fajinyuan
fajinyuan deleted the renovate/httpmock-0.x branch October 21, 2026 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant