pub struct HttpResponse {
pub status: u16,
pub url: String,
pub headers: Vec<(String, String)>,
pub body: Box<dyn Body>,
pub truncated: bool,
}Expand description
An HTTP reply: status, final URL after redirects, headers, a body still
to be read, and truncated when the transport cut the body at its own
size limit. Header names keep the case the transport saw.
Fields§
§status: u16§url: String§headers: Vec<(String, String)>§body: Box<dyn Body>§truncated: boolImplementations§
Source§impl HttpResponse
impl HttpResponse
Sourcepub fn header(&self, name: &str) -> Option<&str>
pub fn header(&self, name: &str) -> Option<&str>
Looks up reply header name, ignoring ASCII case.
When a header repeats, the first value wins.
Returns the value, or None when absent.
Sourcepub fn content_type(&self) -> String
pub fn content_type(&self) -> String
Returns the reply’s media type in lower case without parameters,
such as text/html for Text/HTML; charset=utf-8.
Returns an empty string when there is no content type.
Auto Trait Implementations§
impl !RefUnwindSafe for HttpResponse
impl !Sync for HttpResponse
impl !UnwindSafe for HttpResponse
impl Forget for HttpResponse
impl Freeze for HttpResponse
impl Move for HttpResponse
impl Send for HttpResponse
impl Unpin for HttpResponse
impl UnsafeUnpin for HttpResponsewhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<(String, String)>: UnsafeUnpin,
*const dyn Body is !null: UnsafeUnpin,
PhantomData<dyn Body>: UnsafeUnpin,
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