Skip to content

Commit

Permalink
Merge pull request #67 from little-dude/master
Browse files Browse the repository at this point in the history
add method for PATCH requests
  • Loading branch information
seanmonstar authored Mar 13, 2017
2 parents 45732d2 + 4d6582d commit c929104
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 c929104

Please sign in to comment.