pub struct HttpResponseDescriptor {
pub status: u16,
pub body: Vec<u8>,
}Expand description
One HTTP response a shell hands back for a prior OutgoingRequest.
Fields§
§status: u16The HTTP status code.
body: Vec<u8>The raw response body bytes.
Implementations§
Source§impl HttpResponseDescriptor
impl HttpResponseDescriptor
Sourcepub fn matrix_error(&self) -> Option<(String, String)>
pub fn matrix_error(&self) -> Option<(String, String)>
Parses body as a Matrix-shaped error response
({"errcode": "...", "error": "..."}), returning
(errcode, error) if the body is JSON and carries an errcode
string field. error defaults to "" if absent (the spec makes it
optional). Returns None for a non-JSON body or a JSON body with
no errcode field, regardless of status — callers that only want
this on failure responses should check status themselves first.
Trait Implementations§
Source§impl Clone for HttpResponseDescriptor
impl Clone for HttpResponseDescriptor
Source§impl Debug for HttpResponseDescriptor
impl Debug for HttpResponseDescriptor
impl Eq for HttpResponseDescriptor
Source§impl PartialEq for HttpResponseDescriptor
impl PartialEq for HttpResponseDescriptor
impl StructuralPartialEq for HttpResponseDescriptor
Auto Trait Implementations§
impl Freeze for HttpResponseDescriptor
impl RefUnwindSafe for HttpResponseDescriptor
impl Send for HttpResponseDescriptor
impl Sync for HttpResponseDescriptor
impl Unpin for HttpResponseDescriptor
impl UnsafeUnpin for HttpResponseDescriptor
impl UnwindSafe for HttpResponseDescriptor
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