[][src]Struct httptest::Server

pub struct Server { /* fields omitted */ }

The Server


impl Server[src]

pub fn run() -> Self[src]

Start a server.

The server will run in the background. On Drop it will terminate and assert it's expectations.

pub fn addr(&self) -> SocketAddr[src]

Get the address the server is listening on.

pub fn url(&self, path_and_query: &str) -> Uri[src]

Get a fully formed url to the servers address.

If the server is listening on port 1234.

server.url("/foo?q=1") == "http://localhost:1234/foo?q=1"

pub fn url_str(&self, path_and_query: &str) -> String[src]

Get a fully formed url to the servers address as a String.

server.url_str(foo) == server.url(foo).to_string()

pub fn expect(&self, expectation: Expectation)[src]

Add a new expectation to the server.

pub fn verify_and_clear(&mut self)[src]

Verify all registered expectations. Panic if any are not met, then clear all expectations leaving the server running in a clean state.

Trait Implementations

impl Debug for Server[src]

impl Drop for Server[src]

Auto Trait Implementations

impl !RefUnwindSafe for Server

impl Send for Server

impl Sync for Server

impl Unpin for Server

impl !UnwindSafe for Server

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.