pub trait Endpoint<I, O>: EndpointMetadata {
    // Required method
    fn handle(
        &self,
        req: Request<I>,
        response_extensions: &mut Extensions
    ) -> Result<Response<ResponseBody<O>>, Error>;
}
Expand description

A blocking HTTP endpoint.

Required Methods§

source

fn handle( &self, req: Request<I>, response_extensions: &mut Extensions ) -> Result<Response<ResponseBody<O>>, Error>

Handles a request to the endpoint.

If the endpoint has path parameters, callers must include a PathParams extension in the request containing the extracted parameters from the URI. The implementation is reponsible for all other request handling, including parsing query parameters, header parameters, and the request body.

The response_extensions will be added to the extensions of the response produced by the endpoint, even if an error is returned.

Implementations on Foreign Types§

source§

impl<T, I, O> Endpoint<I, O> for Box<T>
where T: ?Sized + Endpoint<I, O>,

source§

fn handle( &self, req: Request<I>, response_extensions: &mut Extensions ) -> Result<Response<ResponseBody<O>>, Error>

Implementors§