pub struct RequestConfig {
pub url: String,
pub method: HttpMethod,
pub headers: HashMap<String, String>,
pub body: Option<Bytes>,
}Expand description
Configuration for a single HTTP request.
Used by custom request generator functions to specify the details of each request.
When using BenchmarkBuilder::request_fn,
your function returns this struct to configure each individual request.
§Examples
use httpress::{RequestConfig, HttpMethod};
use std::collections::HashMap;
use bytes::Bytes;
let config = RequestConfig {
url: "http://localhost:3000/api/users".to_string(),
method: HttpMethod::Post,
headers: HashMap::from([
("Content-Type".to_string(), "application/json".to_string()),
("Authorization".to_string(), "Bearer token123".to_string()),
]),
body: Some(Bytes::from(r#"{"name": "John"}"#)),
};Fields§
§url: StringThe target URL for this request.
method: HttpMethodThe HTTP method to use.
headers: HashMap<String, String>HTTP headers to include in the request.
body: Option<Bytes>Optional request body.
Trait Implementations§
Source§impl Clone for RequestConfig
impl Clone for RequestConfig
Source§fn clone(&self) -> RequestConfig
fn clone(&self) -> RequestConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !Freeze for RequestConfig
impl RefUnwindSafe for RequestConfig
impl Send for RequestConfig
impl Sync for RequestConfig
impl Unpin for RequestConfig
impl UnsafeUnpin for RequestConfig
impl UnwindSafe for RequestConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more