Skip to content

Commit

Permalink
added in PUT functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
unaffiliated committed Feb 4, 2017
1 parent 69cdfcb commit c37b8aa
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 @@ -56,6 +56,11 @@ impl Client {
pub fn post<U: IntoUrl>(&self, url: U) -> RequestBuilder {
self.request(Method::Post, url)
}

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

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

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

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

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

0 comments on commit c37b8aa

Please sign in to comment.