Expand description
This module provides a test HTTP(S) server that can be instantiated simply by a unit test, for connecting components to where you need to vary the response(s) from the HTTP(S) server during the operation of the test.
It handles the TCP setup, letting the user specify Handler implementations which return the
responses from the server. Handler implementations are meant to be composable to provide
for fault injection and varying behavior in tests.
Modules§
- fault_
injection - These are Handler implementations that are specifically for injecting faults into the behavior of the server.
- handler
- Handler implementations
Structs§
- Test
Server - A “test” HTTP(S) server which is composed of
Handlerimplementations, and holding the connection state. - Test
Server Builder - A builder to construct a
TestServer.
Traits§
- Handler
- Base trait that all Handlers implement.
Functions§
- body_
as_ bytes - Collect a Response into a single Vec of bytes.
- body_
as_ string - Collect a Response’s Body and convert the body to a tring.
- get
- Perform an HTTP GET for the given url, returning the result.
- get_
body_ as_ string - Get a url and return the body of the response as a string.
- make_
get - Create a GET request for a given url, which can be used with any hyper client.