This is a major re-write, introducing a bunch of long awaited features:
[Breaking] The minimum supported Rust version was bumped to 1.65.0
Tests can now run in parallel as long as you use the new mockito::Server API:
let mut server = mockito::Server::new();
let mock = server.mock("GET", "/").with_body("test").create();
// Use one of these to configure your client
let host = server.host_with_port();
let url = server.url();
You can run multiple servers/hosts at the same time:
let mut twitter = mockito::Server::new();
let twitter_mock = server.mock("GET", "/api").with_body("tweet").create();
let twitter_host = twitter.host_with_port();
let mut github = mockito::Server::new();
let github_mock = server.mock("GET", "/api").with_body("repo").create();
let github_host = github.host_with_port();
Support for HTTP2
An async interface for all actions (though the sync interface is also available):
let mut server = Server::new_async().await;
let mock = s
.mock("GET", "/hello")
.with_body("world")
.create_async()
.await;
The backend has been rewritten to use Hyper
This version will be backwards compatible with the previous version, but deprecation warnings have been introduced and you are encouraged to migrate, since the old API still requires running tests sequentially. Migrating to the new API is quite straighforward:
Migrating to the new API
Legacy API:
let m = mockito::mock("GET", "/").with_body("hello").create();
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Updates the requirements on mockito to permit the latest version.
Release notes
Sourced from mockito's releases.
... (truncated)
Commits
04ff906
Bump to 0.32.0432edf7
Merge pull request #153 from lipanski/le-big-rewritef6ab004
Le big rewrite95ae695
Bump to 0.31.18795273
Merge pull request #151 from chantra/mockito_hang_on_invalid_header69d0fdc
Handle httpparse errorDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)