pub struct HttpRequest {
pub methods: Arc<Methods>,
pub url: Arc<String>,
pub header: Arc<HashMap<&'static str, &'static str>>,
pub body: Arc<Body>,
pub config: Config,
pub tmp: Tmp,
pub response: HttpResponse,
}
Expand description
Represents an HTTP request, encapsulating various components such as the method, URL, protocol, headers, body, and additional metadata.
Fields§
§methods: Arc<Methods>
The HTTP method of the request (e.g., GET, POST, etc.).
url: Arc<String>
The target URL of the request.
header: Arc<HashMap<&'static str, &'static str>>
The headers included in the request.
body: Arc<Body>
The type of the body, specifying whether it is text or JSON.
config: Config
Represents the configuration settings for the HTTP request.
tmp: Tmp
Stores temporary data during the HTTP request process.
response: HttpResponse
Http response
Implementations§
Source§impl HttpRequest
impl HttpRequest
Implements methods for the HttpRequest
struct.
These methods provide functionality for managing HTTP requests, including:
- Retrieving or setting HTTP attributes (e.g., URL, headers, protocol).
- Constructing and sending HTTP GET or POST requests.
- Parsing responses and handling redirects.
Sourcepub fn send(&mut self) -> Result<HttpResponse, Error>
pub fn send(&mut self) -> Result<HttpResponse, Error>
Sends the HTTP request.
Determines the HTTP method and constructs the appropriate request (GET or POST).
Returns Ok(HttpResponse)
if the request is successful, or Err(Error)
otherwise.
Trait Implementations§
Source§impl Clone for HttpRequest
impl Clone for HttpRequest
Source§fn clone(&self) -> HttpRequest
fn clone(&self) -> HttpRequest
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for HttpRequest
impl Debug for HttpRequest
Source§impl Default for HttpRequest
impl Default for HttpRequest
Default implementation for HttpRequest
.