pub struct Client {
pub url: String,
pub method: Method,
pub header: HashMap<String, String>,
pub content_type: ContentType,
/* private fields */
}Fields§
§url: String§method: Method§header: HashMap<String, String>§content_type: ContentTypeImplementations§
Source§impl Client
impl Client
pub fn new() -> Self
pub fn debug(&mut self) -> &mut Self
pub fn post(&mut self, url: &str) -> &mut Self
pub fn get(&mut self, url: &str) -> &mut Self
pub fn put(&mut self, url: &str) -> &mut Self
pub fn patch(&mut self, url: &str) -> &mut Self
pub fn delete(&mut self, url: &str) -> &mut Self
pub fn head(&mut self, url: &str) -> &mut Self
pub fn options(&mut self, url: &str) -> &mut Self
pub fn trace(&mut self, url: &str) -> &mut Self
pub fn header(&mut self, key: &str, value: &str) -> &mut Self
pub fn query(&mut self, params: JsonValue) -> &mut Self
Sourcepub fn set_request_timeout(&mut self, s: usize) -> &mut Self
pub fn set_request_timeout(&mut self, s: usize) -> &mut Self
设置连接超时
pub fn set_response_timeout(&mut self, s: usize) -> &mut Self
pub fn set_retry(&mut self, count: usize) -> &mut Self
pub fn set_command(&mut self, cmd: Vec<String>) -> &mut Self
pub fn raw_xml(&mut self, data: JsonValue) -> &mut Self
pub fn raw_stream(&mut self, filename: &str) -> &mut Self
pub fn raw_binary_str(&mut self, text: &str) -> &mut Self
pub fn raw_stream_urlencode(&mut self, text: &str) -> &mut Self
Sourcepub fn form_urlencoded(&mut self, data: JsonValue) -> &mut Self
pub fn form_urlencoded(&mut self, data: JsonValue) -> &mut Self
FormData请求
Sourcepub fn set_cert_p12(&mut self, filename: &str, password: &str) -> &mut Self
pub fn set_cert_p12(&mut self, filename: &str, password: &str) -> &mut Self
开启旧的ssl
Sourcepub fn add_proxy_with_account(
&mut self,
proxy_addr: String,
user: String,
password: String,
)
pub fn add_proxy_with_account( &mut self, proxy_addr: String, user: String, password: String, )
指定代理, 该代理需要用户名和密码认证
pub fn send(&mut self) -> Result<Response, String>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
impl UnwindSafe for Client
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