pub struct HttpRequest {
pub url: String,
pub method: String,
pub headers: HashMap<String, String>,
pub body: Option<Vec<u8>>,
pub timeout_ms: Option<u64>,
}Fields§
§url: String§method: String§headers: HashMap<String, String>§body: Option<Vec<u8>>§timeout_ms: Option<u64>Implementations§
Source§impl HttpRequest
impl HttpRequest
pub fn new<S: Into<String>>(url: S) -> Self
pub fn get<S: Into<String>>(url: S) -> Self
pub fn post<S: Into<String>>(url: S) -> Self
pub fn method<S: Into<String>>(self, method: S) -> Self
pub fn header<K: Into<String>, V: Into<String>>(self, key: K, value: V) -> Self
pub fn headers(self, headers: HashMap<String, String>) -> Self
pub fn body<B: Into<Vec<u8>>>(self, body: B) -> Self
pub fn json<T: Serialize>(self, data: &T) -> Result<Self, Error>
pub fn timeout_ms(self, timeout_ms: u64) -> Self
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§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
Source§impl Default for HttpRequest
impl Default for HttpRequest
Source§fn default() -> HttpRequest
fn default() -> HttpRequest
Returns the “default value” for a type. Read more
Source§impl From<&HttpRequest> for ProtoHttpRequest
impl From<&HttpRequest> for ProtoHttpRequest
Source§fn from(req: &HttpRequest) -> Self
fn from(req: &HttpRequest) -> Self
Converts to this type from the input type.
Source§impl From<HttpRequest> for ProtoHttpRequest
impl From<HttpRequest> for ProtoHttpRequest
Source§fn from(req: HttpRequest) -> Self
fn from(req: HttpRequest) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for HttpRequest
impl RefUnwindSafe for HttpRequest
impl Send for HttpRequest
impl Sync for HttpRequest
impl Unpin for HttpRequest
impl UnwindSafe for HttpRequest
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)