Expand description
§HTTP Request Module
This module provides comprehensive HTTP request building and handling functionality for the Deboa HTTP client. It includes traits and structs for creating, configuring, and executing HTTP requests with various features like authentication, headers, cookies, and body serialization.
§Key Components
IntoRequest: Trait for converting various types into HTTP requestsIntoHeaders: Trait for converting various types into HTTP headersDeboaRequest: Main request structure with full HTTP functionality- Request builders for different HTTP methods (GET, POST, PUT, DELETE, etc.)
- Authentication mechanisms (Basic, Bearer token, custom)
- Header and cookie management
- Form data and JSON serialization support
§Features
- Type-safe request building
- Automatic content-type handling
- Authentication support (Basic, Bearer, custom)
- Cookie jar integration
- Form data and JSON serialization
- File upload support
- Request retry mechanisms
- Custom headers and query parameters
§Examples
§Basic GET Request
ⓘ
use deboa::{Client, request::IntoRequest};
let mut client = Client::new();
let response = "https://api.example.com/data".into_request().execute(&mut client).await?;§POST Request with JSON
ⓘ
use deboa::{Client, request::post};
use deboa_extras::http::serde::json::JsonBody;
let mut client = Client::new();
let response = post("https://api.example.com/users")
.body_as(JsonBody, json!({"name": "John", "age": 30}))?
.send_with(&mut client)
.await?;§Authentication
ⓘ
use deboa::{Client, request::get};
let mut client = Client::new();
let response = get("https://api.example.com/protected")
.basic_auth("username", "password")
.send_with(&mut client)
.await?;Structs§
- Deboa
Request - Deboa
Request Builder - A builder for constructing HTTP requests with various configurations.
Traits§
- Fetch
Deprecated - Trait to allow make a get request from different types.
- Fetch
With - Trait to allow make a get request from different types.
- Into
Headers - Trait to allow adding headers to a request.
- Into
Request - Trait to allow making a request from different types.
- Method
Ext - Extension trait for HTTP methods to create requests. Allows creating requests using method names as strings or Method enum values.
Functions§
- delete
- A utility function to create a DELETE request within DeboaRequest.
- get
- A utility function to create a GET request within DeboaRequest.
- patch
- A utility function to create a PATCH request within DeboaRequest.
- post
- A utility function to create a POST request within DeboaRequest.
- put
- A utility function to create a PUT request within DeboaRequest.