File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,11 @@ impl Client {
5656 pub fn post < U : IntoUrl > ( & self , url : U ) -> RequestBuilder {
5757 self . request ( Method :: Post , url)
5858 }
59+
60+ /// Convenience method to make a `PUT` request to a URL.
61+ pub fn put < U : IntoUrl > ( & self , url : U ) -> RequestBuilder {
62+ self . request ( Method :: Put , url)
63+ }
5964
6065 /// Convenience method to make a `HEAD` request to a URL.
6166 pub fn head < U : IntoUrl > ( & self , url : U ) -> RequestBuilder {
@@ -396,6 +401,16 @@ mod tests {
396401 assert_eq ! ( r. url, Url :: parse( some_url) ) ;
397402 }
398403
404+ #[ test]
405+ fn basic_put_request ( ) {
406+ let client = Client :: new ( ) . unwrap ( ) ;
407+ let some_url = "https://google.com" ;
408+ let r = client. put ( some_url) ;
409+
410+ assert_eq ! ( r. method, Method :: Put ) ;
411+ assert_eq ! ( r. url, Url :: parse( some_url) ) ;
412+ }
413+
399414 #[ test]
400415 fn add_header ( ) {
401416 let client = Client :: new ( ) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments