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>
impl<C, B> Client<C, B>
sourcepub fn get(&self, uri: Uri) -> ResponseFuturewhere
B: Default,
pub fn get(&self, uri: Uri) -> ResponseFuturewhere
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"));
sourcepub fn request(&self, req: Request<B>) -> ResponseFuture
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);