pub struct ResponseInfo {
pub status: u16,
pub reason: Option<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 response_time: Option<Duration>,
}Expand description
HTTP response information for inspection.
Fields§
§status: u16HTTP status code.
reason: Option<String>Status reason phrase (e.g., “OK”, “Not Found”).
headers: Vec<(String, String)>Response headers.
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.
response_time: Option<Duration>Total response time.
Implementations§
Source§impl ResponseInfo
impl ResponseInfo
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 response_time(self, duration: Duration) -> Self
pub fn response_time(self, duration: Duration) -> Self
Set the response time.
Sourcepub fn default_reason(&self) -> &'static str
pub fn default_reason(&self) -> &'static str
Get the default reason phrase for the status code.
Trait Implementations§
Source§impl Clone for ResponseInfo
impl Clone for ResponseInfo
Source§fn clone(&self) -> ResponseInfo
fn clone(&self) -> ResponseInfo
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 ResponseInfo
impl RefUnwindSafe for ResponseInfo
impl Send for ResponseInfo
impl Sync for ResponseInfo
impl Unpin for ResponseInfo
impl UnsafeUnpin for ResponseInfo
impl UnwindSafe for ResponseInfo
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