Module request

Module request 

Source
Expand description

Request types used by the crawler runtime.

Request is the runtime’s transport-neutral request model. It stores the URL, method, headers, optional body, and a lazily allocated metadata map used by middleware and runtime internals.

§Example

use spider_util::request::{Body, Method, Request};
use url::Url;
use serde_json::json;

// Create a simple GET request
let url = Url::parse("https://example.com")?;
let request = Request::new(url);

// Parse the URL as part of request construction
let parsed_request = Request::try_new("https://example.com")?;

// Create a POST request with JSON body
let post_request = Request::new(Url::parse("https://api.example.com/data")?)
    .with_method(Method::Post)
    .with_json(json!({"key": "value"}));

Structs§

Request
Outgoing HTTP request used by the crawler runtime.

Enums§

Body
Request body variants supported by the default downloader.
Method
Transport-neutral HTTP method used by Request.