Skip to content

Commit

Permalink
add method for PATCH requests
Browse files Browse the repository at this point in the history
  • Loading branch information
little-dude committed Mar 12, 2017
1 parent 45732d2 commit 4d6582d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ impl Client {
self.request(Method::Put, url)
}

/// Convenience method to make a `PATCH` request to a URL.
pub fn patch<U: IntoUrl>(&self, url: U) -> RequestBuilder {
self.request(Method::Patch, url)
}

/// Convenience method to make a `DELETE` request to a URL.
pub fn delete<U: IntoUrl>(&self, url: U) -> RequestBuilder {
self.request(Method::Delete, url)
Expand Down Expand Up @@ -511,6 +516,16 @@ mod tests {
assert_eq!(r.url, Url::parse(some_url));
}

#[test]
fn basic_patch_request() {
let client = Client::new().unwrap();
let some_url = "https://google.com";
let r = client.patch(some_url);

assert_eq!(r.method, Method::Patch);
assert_eq!(r.url, Url::parse(some_url));
}

#[test]
fn basic_delete_request() {
let client = Client::new().unwrap();
Expand Down

0 comments on commit 4d6582d

Please sign in to comment.