pub struct HttpResponse {
pub status: u16,
pub headers: HashMap<String, String>,
pub body: Vec<u8>,
}Expand description
One response, body already collected.
Fields§
§status: u16§headers: HashMap<String, String>§body: Vec<u8>Implementations§
Source§impl HttpResponse
impl HttpResponse
Sourcepub fn error_for_status(&self, method: &str, path: &str) -> Result<(), Error>
pub fn error_for_status(&self, method: &str, path: &str) -> Result<(), Error>
The typed error for this response, or Ok for a 2xx.
Every non-2xx goes through here, so the status-to-WireKind table is applied
in exactly one place. A status the daemon never chooses becomes a
WireKind::ServerError-free plain protocol failure rather than being mapped
to the nearest neighbour — see crate::error::WireKind::from_status on why
there is no generic 4xx fallback.
Trait Implementations§
Source§impl Clone for HttpResponse
impl Clone 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