Trait apisdk::Responder

source ·
pub trait Responder:
    'static
    + Send
    + Sync {
    // Required method
    fn handle<'life0, 'async_trait>(
        &'life0 self,
        req: Request,
    ) -> Pin<Box<dyn Future<Output = Result<ResponseBody>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn type_name(&self) -> &str { ... }
}
Expand description

Reply a response to request. It should be used with MockServer.

Required Methods§

source

fn handle<'life0, 'async_trait>( &'life0 self, req: Request, ) -> Pin<Box<dyn Future<Output = Result<ResponseBody>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handle the request

  • req: HTTP request

Provided Methods§

source

fn type_name(&self) -> &str

Get type_name, used in Debug

Implementors§

source§

impl Responder for MockServer

source§

impl<F> Responder for F
where F: 'static + Send + Sync + Fn(Request) -> Result<ResponseBody>,

Implement Responder for function / closure