From 6f71409355d6c51501dfdad2deb2efac13a8174f Mon Sep 17 00:00:00 2001 From: Andrea Corradi Date: Tue, 16 Jul 2019 06:19:28 +0200 Subject: [PATCH] Add DELETE, PATCH, OPTIONS methods to TestServerRunner (#973) --- CHANGES.md | 1 + test-server/src/lib.rs | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 0b3f3e0c3..0943fbdcf 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,6 +5,7 @@ ### Added * Add `Responder` impl for `(T, StatusCode) where T: Responder` +* Add `delete`, `options`, `patch` methods to `TestServerRunner` ### Changed diff --git a/test-server/src/lib.rs b/test-server/src/lib.rs index 1fbaa6c74..c49026faa 100644 --- a/test-server/src/lib.rs +++ b/test-server/src/lib.rs @@ -265,6 +265,36 @@ impl TestServerRuntime { self.client.put(self.surl(path.as_ref()).as_str()) } + /// Create `PATCH` request + pub fn patch>(&self, path: S) -> ClientRequest { + self.client.patch(self.url(path.as_ref()).as_str()) + } + + /// Create https `PATCH` request + pub fn spatch>(&self, path: S) -> ClientRequest { + self.client.patch(self.surl(path.as_ref()).as_str()) + } + + /// Create `DELETE` request + pub fn delete>(&self, path: S) -> ClientRequest { + self.client.delete(self.url(path.as_ref()).as_str()) + } + + /// Create https `DELETE` request + pub fn sdelete>(&self, path: S) -> ClientRequest { + self.client.delete(self.surl(path.as_ref()).as_str()) + } + + /// Create `OPTIONS` request + pub fn options>(&self, path: S) -> ClientRequest { + self.client.options(self.url(path.as_ref()).as_str()) + } + + /// Create https `OPTIONS` request + pub fn soptions>(&self, path: S) -> ClientRequest { + self.client.options(self.surl(path.as_ref()).as_str()) + } + /// Connect to test http server pub fn request>(&self, method: Method, path: S) -> ClientRequest { self.client.request(method, path.as_ref())