diff --git a/src/client.rs b/src/client.rs index 4b057072f..e5fea00f5 100644 --- a/src/client.rs +++ b/src/client.rs @@ -56,12 +56,17 @@ impl Client { pub fn post(&self, url: U) -> RequestBuilder { self.request(Method::Post, url) } - + /// Convenience method to make a `PUT` request to a URL. pub fn put(&self, url: U) -> RequestBuilder { self.request(Method::Put, url) } + /// Convenience method to make a `DELETE` request to a URL. + pub fn delete(&self, url: U) -> RequestBuilder { + self.request(Method::Delete, url) + } + /// Convenience method to make a `HEAD` request to a URL. pub fn head(&self, url: U) -> RequestBuilder { self.request(Method::Head, url) @@ -411,6 +416,16 @@ mod tests { assert_eq!(r.url, Url::parse(some_url)); } + #[test] + fn basic_delete_request() { + let client = Client::new().unwrap(); + let some_url = "https://google.com"; + let r = client.delete(some_url); + + assert_eq!(r.method, Method::Delete); + assert_eq!(r.url, Url::parse(some_url)); + } + #[test] fn add_header() { let client = Client::new().unwrap();