pub struct TestClient { /* private fields */ }Expand description
HTTP 测试客户端
用于构建 HTTP 请求的测试工具。
Implementations§
Source§impl TestClient
impl TestClient
Sourcepub fn query_param<K, V>(self, key: K, value: V) -> Self
pub fn query_param<K, V>(self, key: K, value: V) -> Self
添加查询参数
Sourcepub fn query_params(self, params: HashMap<String, String>) -> Self
pub fn query_params(self, params: HashMap<String, String>) -> Self
设置多个查询参数
Sourcepub fn get(self, url: impl Into<String>) -> RequestBuilder
pub fn get(self, url: impl Into<String>) -> RequestBuilder
创建 GET 请求
Sourcepub fn post(self, url: impl Into<String>) -> RequestBuilder
pub fn post(self, url: impl Into<String>) -> RequestBuilder
创建 POST 请求
Sourcepub fn put(self, url: impl Into<String>) -> RequestBuilder
pub fn put(self, url: impl Into<String>) -> RequestBuilder
创建 PUT 请求
Sourcepub fn delete(self, url: impl Into<String>) -> RequestBuilder
pub fn delete(self, url: impl Into<String>) -> RequestBuilder
创建 DELETE 请求
Sourcepub fn patch(self, url: impl Into<String>) -> RequestBuilder
pub fn patch(self, url: impl Into<String>) -> RequestBuilder
创建 PATCH 请求
Sourcepub fn head(self, url: impl Into<String>) -> RequestBuilder
pub fn head(self, url: impl Into<String>) -> RequestBuilder
创建 HEAD 请求
Sourcepub fn options(self, url: impl Into<String>) -> RequestBuilder
pub fn options(self, url: impl Into<String>) -> RequestBuilder
创建 OPTIONS 请求
Trait Implementations§
Source§impl Clone for TestClient
impl Clone for TestClient
Source§fn clone(&self) -> TestClient
fn clone(&self) -> TestClient
Returns a duplicate of the value. Read more
1.0.0 · 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 TestClient
impl Debug for TestClient
Auto Trait Implementations§
impl Freeze for TestClient
impl RefUnwindSafe for TestClient
impl Send for TestClient
impl Sync for TestClient
impl Unpin for TestClient
impl UnsafeUnpin for TestClient
impl UnwindSafe for TestClient
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