Skip to main content

Module client

Module client 

Source
Expand description

HTTP client.

use ntex::client::Client;

#[ntex::main]
async fn main() {
    let client = Client::new();

    let response = client
        .get("https://www.rust-lang.org")
        .header("User-Agent", "ntex")
        .send()
        .await;

    println!("Response: {response:?}");
}

Modules§

error
HTTP client errors.

Structs§

Client
An HTTP client.
ClientBuilder
An HTTP client builder.
ClientConfig
Runtime configuration for an HTTP Client.
ClientRequest
An HTTP client request builder.
ClientResponse
An HTTP client response.
JsonBody
Future that buffers and deserializes a JSON response body.
MessageBody
Future that buffers a complete HTTP response body.
ServiceRequest
HTTP request passed through client middleware before it is sent.
ServiceResponse
HTTP response passed through client middleware.
TestResponse
Builder for creating a ClientResponse in tests.