pub struct HttpResponse {
pub status: u16,
pub headers: BTreeMap<String, String>,
pub body: String,
}Fields§
§status: u16§headers: BTreeMap<String, String>§body: StringImplementations§
Source§impl HttpResponse
impl HttpResponse
pub fn is_success(&self) -> bool
Sourcepub fn error_for_status(&self, what: &str) -> Result<()>
pub fn error_for_status(&self, what: &str) -> Result<()>
Turns a non-2xx into a typed error carrying whatever the host said. 401 and 403 are separated because they are the two a user can fix, and a bare “401” sends people looking for a network problem that was a stale token.
pub fn json<T: DeserializeOwned>(&self) -> Result<T>
Trait Implementations§
Source§impl Clone for HttpResponse
impl Clone for HttpResponse
Auto Trait Implementations§
impl Forget for HttpResponse
impl Freeze for HttpResponse
impl Move for HttpResponse
impl RefUnwindSafe for HttpResponse
impl Send for HttpResponse
impl Sync for HttpResponse
impl Unpin for HttpResponse
impl UnsafeUnpin for HttpResponsewhere
*const LeafNode<String, String> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, String)>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
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