1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-28 01:32:57 +01:00

test-server: Request functions should accept path (#743)

This commit is contained in:
Douman 2019-03-30 17:53:45 +03:00 committed by Nikolay Kim
parent a20b9fd354
commit 2e159d1eb9

View File

@ -159,33 +159,33 @@ impl TestServerRuntime {
} }
/// Create `GET` request /// Create `GET` request
pub fn get(&self) -> ClientRequest { pub fn get<S: AsRef<str>>(&self, path: S) -> ClientRequest {
self.client.get(self.url("/").as_str()) self.client.get(self.url(path.as_ref()).as_str())
} }
/// Create https `GET` request /// Create https `GET` request
pub fn sget(&self) -> ClientRequest { pub fn sget<S: AsRef<str>>(&self, path: S) -> ClientRequest {
self.client.get(self.surl("/").as_str()) self.client.get(self.surl(path.as_ref()).as_str())
} }
/// Create `POST` request /// Create `POST` request
pub fn post(&self) -> ClientRequest { pub fn post<S: AsRef<str>>(&self, path: S) -> ClientRequest {
self.client.post(self.url("/").as_str()) self.client.post(self.url(path.as_ref()).as_str())
} }
/// Create https `POST` request /// Create https `POST` request
pub fn spost(&self) -> ClientRequest { pub fn spost<S: AsRef<str>>(&self, path: S) -> ClientRequest {
self.client.post(self.surl("/").as_str()) self.client.post(self.surl(path.as_ref()).as_str())
} }
/// Create `HEAD` request /// Create `HEAD` request
pub fn head(&self) -> ClientRequest { pub fn head<S: AsRef<str>>(&self, path: S) -> ClientRequest {
self.client.head(self.url("/").as_str()) self.client.head(self.url(path.as_ref()).as_str())
} }
/// Create https `HEAD` request /// Create https `HEAD` request
pub fn shead(&self) -> ClientRequest { pub fn shead<S: AsRef<str>>(&self, path: S) -> ClientRequest {
self.client.head(self.surl("/").as_str()) self.client.head(self.surl(path.as_ref()).as_str())
} }
/// Connect to test http server /// Connect to test http server