- Features:
- Functions from
&Request
toResponseTemplate
can now be passed toMockBuilder::respond_with
. You do not have to write a struct with aRespond
implementation for simple manipulation of request data! (by @RoGryza)
- Functions from
- Fixes:
MockGuard
is now marked asmust_use
, ensuring that a compiler warning is raised if the guard for a scoped mock is not bound to a variable.
- Features:
- Added support for scoped
Mock
s! UsingMockServer::register_as_scoped
orMock::mount_as_scoped
you can now registerMock
s that go "out of scope" when the returned RAII guard (MockGuard
) is dropped. ScopedMock
s are recommended for usage in test helper functions to ensure proper isolation - check the documentation for more details! (by @LukeMathWalker)
- Added support for scoped
- Miscellaneous:
- Added the
http
module to re-export the types fromhttp-types
that are part ofwiremock
's public API (by @LukeMathWalker).
- Added the
- Fixes:
- Handle URI authority properly in the mock server (by @Tuetuopay)
- Miscellaneous:
- Remove
textwrap
from the dependency tree (by @apiraino)
- Remove
- Features:
- Capture the port in
hyper
'sRequest
intowiremock::Request::url
(by @beltram)
- Capture the port in
- Breaking changes:
- Removed
MockServer::start_on
.
UseMockServer::builder
andMockServerBuilder::listener
to configure yourMockServer
to start on a pre-determined port (by @LukeMathWalker). MockServer::verify
is now asynchronous (by @LukeMathWalker).
- Removed
- Features:
- Added request recording to
MockServer
, enabled by default.
The recorded requests are used to display more meaningful error messages when assertions are not satisfied and can be retrieved usingMockServer::received_requests
([by @LukeMathWalker]). - Added
MockServerBuilder
to customise the configuration of aMockServer
.
It can be used to bind aMockServer
to an existingTcpListener
as well as disabling request recording (by @LukeMathWalker). - Added
matchers::body_json_schema
to verify the structure of the body attached to an incoming request (by @Michael-J-Ward).
- Added request recording to