http-request 21.10.0

http-request is a lightweight, efficient library for building, sending, and handling HTTP/HTTPS requests in Rust applications. It provides a simple and intuitive API, allowing developers to easily interact with web services, whether they use the "HTTP" or "HTTPS" protocol. The library supports various HTTP methods, custom headers, request bodies, timeout, automatic handling of redirects (including detecting redirect loops), and enhanced response body decoding (both automatic and manual), enabling fast and secure communication. Whether working with secure "HTTPS" connections or standard "HTTP" requests, the library is optimized for performance, minimal resource usage, and easy integration into Rust projects.
Documentation
use super::*;

/// Parsed HTTP response.
///
/// Value type with all fields public — no `Arc<RwLock>` wrapping, no
/// associated-type / boxed-trait indirection. Use the field accessors
/// directly (`response.status_code`, `response.body`, ...) or the
/// convenience helpers (`response.text()`, `response.is_success()`).
///
/// `HttpResponse` is `Clone` and `Debug`. Decoding is a method
/// ([`HttpResponse::decode`]) that returns a fresh `HttpResponse` with
/// the body expanded — original is untouched.
#[derive(Clone, Debug, Getter, Setter)]
pub struct HttpResponse {
    /// HTTP version (`HTTP/1.1`, `HTTP/2`, ...).
    pub version: HttpVersion,
    /// 3-digit numeric status code (`200`, `404`, ...).
    #[get(type(copy))]
    pub status_code: ResponseStatusCode,
    /// Reason phrase (`"OK"`, `"Not Found"`, ...).
    #[set(type(AsRef<str>))]
    pub reason_phrase: String,
    /// Response headers (single-value, lowercase keys).
    pub headers: HttpResponseHeaders,
    /// Raw response body bytes.
    #[set(type(AsRef<[u8]>))]
    pub body: ResponseBody,
}