Module httptest::responders[][src]

Responder implementations.

Reponders determine how the server will respond.

Notable types that implement responder are

  • ResponseBuilder
    • The ResponseBuilder can be constructed via the status_code function, and has convenience methods to modify the response further.
  • http::Response<String> or http::Response<Vec<u8>>
  • A function that returns a Responder.
    • The function is allowed to make arbitrary blocking calls like std::thread::sleep or reading from a file without impacting concurrent connections to the server.

Macros

cycle

a Responder that cycles through a list of responses.

Structs

Cycle

The Cycle responder returned by cycle()

Delay

Responder that delays the embedded response

ResponseBuilder

Convenient ResponseBuilder that implements Responder.

Traits

Responder

Respond with an HTTP response.

Functions

cycle

Cycle through the provided list of responders.

delay_and_then

respond with the given responder after a delay

json_encoded

respond with a body that is the json encoding of data.

status_code

respond with the provided status code and an empty body.

url_encoded

respond with a body that is the url encoding of data.