Crate fuchsia_hyper_test_support

Crate fuchsia_hyper_test_support 

Source
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§

TestServer
A “test” HTTP(S) server which is composed of Handler implementations, and holding the connection state.
TestServerBuilder
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.