pub struct TestServer { /* private fields */ }
Expand description

A means to run Axum applications within a server that you can query. This is for writing tests.

Implementations§

This will take the given app, and run it. It will be run on a randomly picked port.

The webserver is then wrapped within a TestServer, and returned.

This function is for quick use. It will panic if it cannot create the webserver.

Creates a TestServer running your app on the address given.

Performs a GET request to the path.

This will presume the response is successful (a 200 status code). If a different status code is returned, then this will panic.

Performs a GET request to the path.

This will panic if the response is successful. It presumes the response would have failed.

Performs a POST request to the path.

This will presume the response is successful (a 200 status code). If a different status code is returned, then this will panic.

Performs a POST request to the path.

This will panic if the response is successful. It presumes the response would have failed.

Performs a PATCH request to the path.

This will panic if the response is successful. It presumes the response would have failed.

Performs a PATCH request to the path.

This will panic if the response is successful. It presumes the response would have failed.

Performs a PUT request to the path.

This will presume the response is successful (a 200 status code). If a different status code is returned, then this will panic.

Performs a PUT request to the path.

This will panic if the response is successful. It presumes the response would have failed.

Performs a DELETE request to the path.

This will presume the response is successful (a 200 status code). If a different status code is returned, then this will panic.

Performs a DELETE request to the path.

This will panic if the response is successful. It presumes the response would have failed.

Trait Implementations§

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more