Function http_typed::send

source ·
pub async fn send<Req>(
    base_url: &str,
    request: Req
) -> Result<Req::Response, Error<<Req::Serializer as SerializeBody<Req>>::Error>>where
    Req: Request,
    Req::Response: for<'a> Deserialize<'a>,
Expand description

Convenience function to create a client and send a request using minimal boilerplate. Creating a client is expensive, so you should not use this function if you plan on sending multiple requests.

Equivalent to:

  • Client::new(base_url).send(request)
  • Client::default().send_to(base_url, request)

Send the provided request to the host at the specified base url, using the request metadata specified by the Request implementation to create the http request and determine the response type.

The url used for the request is {base_url}{request.path()}