pub struct HttpResponse {
pub status_code: u16,
pub status_text: String,
pub headers: HashMap<String, String>,
pub content_type: Option<String>,
pub body: String,
pub body_bytes: Option<Vec<u8>>,
pub is_success: bool,
pub request_method: String,
pub request_url: String,
pub request_body: String,
}Expand description
HTTP response from an API call
Fields§
§status_code: u16§status_text: String§headers: HashMap<String, String>§content_type: Option<String>§body: String§body_bytes: Option<Vec<u8>>§is_success: bool§request_method: String§request_url: String§request_body: StringImplementations§
Source§impl HttpResponse
impl HttpResponse
Sourcepub fn is_image(&self) -> bool
pub fn is_image(&self) -> bool
Check if the response contains image content
Uses the mime crate to properly parse and validate image content types.
Sourcepub fn is_binary(&self) -> bool
pub fn is_binary(&self) -> bool
Check if the response contains binary content (image, audio, or video)
Uses the mime crate to properly parse and validate binary content types.
Sourcepub fn to_mcp_content(&self) -> String
pub fn to_mcp_content(&self) -> String
Get a formatted response summary for MCP
Trait Implementations§
Source§impl Clone for HttpResponse
impl Clone for HttpResponse
Source§fn clone(&self) -> HttpResponse
fn clone(&self) -> HttpResponse
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 HttpResponse
impl RefUnwindSafe for HttpResponse
impl Send for HttpResponse
impl Sync for HttpResponse
impl Unpin for HttpResponse
impl UnwindSafe for HttpResponse
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