[−][src]Module httptest::responders
Responder implementations.
Reponders determine how the server will respond.
Notable types that implement responder are
ResponseBuilder
- The
ResponseBuilder
can be constructed via thestatus_code
function, and has convenience methods to modify the response further.
- The
http::Response<String>
orhttp::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 |
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. |