#[repr(C)]pub struct HttpResponse {
pub status_code: u16,
pub body: U8Vec,
pub content_type: AzString,
pub content_length: u64,
pub headers: HttpHeaderVec,
}Expand description
HTTP response with status code, headers, and body
Fields§
§status_code: u16HTTP status code (200, 404, etc.)
body: U8VecResponse body as bytes
content_type: AzStringContent-Type header value
content_length: u64Content-Length header value (0 if unknown)
headers: HttpHeaderVecResponse headers
Implementations§
Source§impl HttpResponse
impl HttpResponse
Sourcepub const fn is_success(&self) -> bool
pub const fn is_success(&self) -> bool
Check if the response was successful (2xx status)
Sourcepub const fn is_redirect(&self) -> bool
pub const fn is_redirect(&self) -> bool
Check if the response is a redirect (3xx status)
Sourcepub const fn is_client_error(&self) -> bool
pub const fn is_client_error(&self) -> bool
Check if the response is a client error (4xx status)
Sourcepub const fn is_server_error(&self) -> bool
pub const fn is_server_error(&self) -> bool
Check if the response is a server error (5xx status)
Sourcepub fn body_as_string(&self) -> Option<AzString>
pub fn body_as_string(&self) -> Option<AzString>
Try to convert the body to a UTF-8 string
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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HttpResponse
impl Debug for HttpResponse
Source§impl PartialEq for HttpResponse
impl PartialEq for HttpResponse
impl StructuralPartialEq for HttpResponse
Auto Trait Implementations§
impl Freeze for HttpResponse
impl RefUnwindSafe for HttpResponse
impl Send for HttpResponse
impl Sync for HttpResponse
impl Unpin for HttpResponse
impl UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more