std.net.http.test.RunningServer
type pub inline RunningServerA handle to a running mock HTTP server.
Instance methods
prepare_client
Show source codeHide source code
fn pub prepare_client(client: mut Client) {
client.base_uri = Option.Some(uri)
client.random = Random.from_int(0)
}fn pub prepare_client(client: mut Client)Prepares a Client so it redirects its requests to the mock server.
Using this method is preferred over manually populating a Client whenever
possible.
uri
Show source codeHide source code
fn pub uri -> Uri {
@uri.clone
}fn pub uri -> UriReturns a std.uri.Uri to use for connecting to the mock HTTP server.
This Uri should be used to populate the Client.base_uri field of a
std.net.http.client.Client used to perform HTTP requests that need to be
mocked.
Implemented traits
Drop
impl Drop for RunningServer