pub struct ResponseExt(/* private fields */);Expand description
Extended response wrapper with additional processing capabilities.
This structure wraps a reqwest::Response and provides additional
methods for extracting and formatting response data according to
filtering rules defined in response profiles.
Implementations§
Source§impl ResponseExt
impl ResponseExt
Sourcepub fn into_inner(self) -> Response
pub fn into_inner(self) -> Response
Sourcepub async fn get_text(self, profile: &ResponseProfile) -> Result<String>
pub async fn get_text(self, profile: &ResponseProfile) -> Result<String>
Extracts formatted text from the response according to profile rules.
This method processes the HTTP response and formats it as text, applying any skip rules defined in the response profile for headers and body content.
§Arguments
profile- Response profile containing skip rules for headers and body
§Returns
A Result<String> containing the formatted response text, including
status line, filtered headers, and filtered body content.
§Examples
use xdiff_live::config::{ResponseExt, ResponseProfile};
let profile = ResponseProfile {
skip_headers: vec!["date".to_string(), "server".to_string()],
skip_body: vec!["timestamp".to_string()],
};
let formatted_text = response_ext.get_text(&profile).await?;
println!("{}", formatted_text);Sourcepub fn get_header_keys(&self) -> Vec<String>
pub fn get_header_keys(&self) -> Vec<String>
Extracts all header keys from the response.
This method returns a list of all header names present in the response, which can be useful for debugging or dynamic header processing.
§Returns
A vector of header names as strings.
§Examples
use xdiff_live::config::ResponseExt;
let header_keys = response_ext.get_header_keys();
println!("Response headers: {:?}", header_keys);