Type Alias mas_http::TracedClient

source ·
pub type TracedClient<B> = Client<TracedConnector, B>;

Aliased Type§

struct TracedClient<B> { /* private fields */ }

Implementations

source§

impl<C, B> Client<C, B>
where C: Connect + Clone + Send + Sync + 'static, B: Body + Send + 'static + Unpin, <B as Body>::Data: Send, <B as Body>::Error: Into<Box<dyn Error + Send + Sync>>,

source

pub fn get(&self, uri: Uri) -> ResponseFuture
where B: Default,

Send a GET request to the supplied Uri.

§Note

This requires that the Body type have a Default implementation. It should return an “empty” version of itself, such that Body::is_end_stream is true.

§Example
use hyper::Uri;
use hyper_util::client::legacy::Client;
use hyper_util::rt::TokioExecutor;
use bytes::Bytes;
use http_body_util::Full;

let client: Client<_, Full<Bytes>> = Client::builder(TokioExecutor::new()).build_http();

let future = client.get(Uri::from_static("http://httpbin.org/ip"));
source

pub fn request(&self, req: Request<B>) -> ResponseFuture

Send a constructed Request using this Client.

§Example
use hyper::{Method, Request};
use hyper_util::client::legacy::Client;
use http_body_util::Full;
use hyper_util::rt::TokioExecutor;
use bytes::Bytes;

let client: Client<_, Full<Bytes>> = Client::builder(TokioExecutor::new()).build_http();

let req: Request<Full<Bytes>> = Request::builder()
    .method(Method::POST)
    .uri("http://httpbin.org/post")
    .body(Full::from("Hallo!"))
    .expect("request builder");

let future = client.request(req);

Trait Implementations

source§

impl<C, B> Clone for Client<C, B>
where C: Clone,

source§

fn clone(&self) -> Client<C, B>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<C, B> Debug for Client<C, B>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<C, B> Service<Request<B>> for Client<C, B>
where C: Connect + Clone + Send + Sync + 'static, B: Body + Send + 'static + Unpin, <B as Body>::Data: Send, <B as Body>::Error: Into<Box<dyn Error + Send + Sync>>,

§

type Response = Response<Incoming>

Responses given by the service.
§

type Error = Error

Errors produced by the service.
§

type Future = ResponseFuture

The future response value.
source§

fn poll_ready( &mut self, _: &mut Context<'_>, ) -> Poll<Result<(), <Client<C, B> as Service<Request<B>>>::Error>>

Returns Poll::Ready(Ok(())) when the service is able to process requests. Read more
source§

fn call( &mut self, req: Request<B>, ) -> <Client<C, B> as Service<Request<B>>>::Future

Process the request and return the response asynchronously. Read more