pub struct HttpRequest {
pub method: Method,
pub url: String,
pub headers: Vec<(String, String)>,
pub body: Option<Vec<u8>>,
pub accept: Vec<String>,
}Expand description
One outgoing HTTP request for any transport.
accept lists the media types a 2xx answer may have (empty accepts any;
guarded transports enforce it). Debug prints header names only, so a
request holding an API key can be logged safely.
Fields§
§method: Method§url: String§headers: Vec<(String, String)>§body: Option<Vec<u8>>§accept: Vec<String>Implementations§
Source§impl HttpRequest
impl HttpRequest
Sourcepub fn get(url: &str) -> HttpRequest
pub fn get(url: &str) -> HttpRequest
Builds a GET request for url with no headers, no body and any
accepted media type.
Returns the request for further field edits.
Trait Implementations§
Source§impl Clone for HttpRequest
impl Clone for HttpRequest
Source§fn clone(&self) -> HttpRequest
fn clone(&self) -> HttpRequest
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 HttpRequest
impl Debug for HttpRequest
impl Eq for HttpRequest
Source§impl PartialEq for HttpRequest
impl PartialEq for HttpRequest
impl StructuralPartialEq for HttpRequest
Auto Trait Implementations§
impl Forget for HttpRequest
impl Freeze for HttpRequestwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<(String, String)>: Freeze,
PhantomData<String>: Freeze,
impl Move for HttpRequest
impl RefUnwindSafe for HttpRequest
impl Send for HttpRequestwhere
RawVecInner: Send,
impl Sync for HttpRequestwhere
RawVecInner: Sync,
impl Unpin for HttpRequest
impl UnsafeUnpin for HttpRequestwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<(String, String)>: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
impl UnwindSafe for HttpRequestwhere
RawVecInner: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.