pub struct RequestInfo {
pub method: String,
pub path: String,
pub query: Option<String>,
pub http_version: String,
pub headers: Vec<(String, String)>,
pub body_preview: Option<String>,
pub body_size: Option<usize>,
pub body_truncated: bool,
pub content_type: Option<String>,
pub parse_duration: Option<Duration>,
pub client_ip: Option<String>,
pub request_id: Option<String>,
}Expand description
HTTP request information for inspection.
Fields§
§method: StringHTTP method (GET, POST, etc.).
path: StringRequest path.
query: Option<String>Query string (without leading ?).
http_version: StringHTTP version (e.g., “HTTP/1.1”).
headers: Vec<(String, String)>Request headers as key-value pairs.
body_preview: Option<String>Body preview (may be truncated).
body_size: Option<usize>Total body size in bytes.
body_truncated: boolWhether the body was truncated.
content_type: Option<String>Content-Type header value.
parse_duration: Option<Duration>Parse duration (time to parse the request).
client_ip: Option<String>Client IP address.
request_id: Option<String>Request ID.
Implementations§
Source§impl RequestInfo
impl RequestInfo
Sourcepub fn new(method: impl Into<String>, path: impl Into<String>) -> Self
pub fn new(method: impl Into<String>, path: impl Into<String>) -> Self
Create a new request info with minimal data.
Sourcepub fn http_version(self, version: impl Into<String>) -> Self
pub fn http_version(self, version: impl Into<String>) -> Self
Set the HTTP version.
Sourcepub fn headers(
self,
headers: impl IntoIterator<Item = (impl Into<String>, impl Into<String>)>,
) -> Self
pub fn headers( self, headers: impl IntoIterator<Item = (impl Into<String>, impl Into<String>)>, ) -> Self
Set headers from an iterator.
Sourcepub fn body_preview(self, preview: impl Into<String>, total_size: usize) -> Self
pub fn body_preview(self, preview: impl Into<String>, total_size: usize) -> Self
Set the body preview.
Sourcepub fn content_type(self, content_type: impl Into<String>) -> Self
pub fn content_type(self, content_type: impl Into<String>) -> Self
Set the content type.
Sourcepub fn parse_duration(self, duration: Duration) -> Self
pub fn parse_duration(self, duration: Duration) -> Self
Set the parse duration.
Sourcepub fn request_id(self, id: impl Into<String>) -> Self
pub fn request_id(self, id: impl Into<String>) -> Self
Set the request ID.
Trait Implementations§
Source§impl Clone for RequestInfo
impl Clone for RequestInfo
Source§fn clone(&self) -> RequestInfo
fn clone(&self) -> RequestInfo
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 RequestInfo
impl RefUnwindSafe for RequestInfo
impl Send for RequestInfo
impl Sync for RequestInfo
impl Unpin for RequestInfo
impl UnsafeUnpin for RequestInfo
impl UnwindSafe for RequestInfo
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