Improve RequestBuilder.form() docs (#1490)
				
					
				
			This commit is contained in:
		| @@ -375,6 +375,32 @@ impl RequestBuilder { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     /// Send a form body. |     /// Send a form body. | ||||||
|  |     /// | ||||||
|  |     /// Sets the body to the url encoded serialization of the passed value, | ||||||
|  |     /// and also sets the `Content-Type: application/x-www-form-urlencoded` | ||||||
|  |     /// header. | ||||||
|  |     /// | ||||||
|  |     /// ```rust | ||||||
|  |     /// # use reqwest::Error; | ||||||
|  |     /// # use std::collections::HashMap; | ||||||
|  |     /// # | ||||||
|  |     /// # async fn run() -> Result<(), Error> { | ||||||
|  |     /// let mut params = HashMap::new(); | ||||||
|  |     /// params.insert("lang", "rust"); | ||||||
|  |     /// | ||||||
|  |     /// let client = reqwest::Client::new(); | ||||||
|  |     /// let res = client.post("http://httpbin.org") | ||||||
|  |     ///     .form(¶ms) | ||||||
|  |     ///     .send() | ||||||
|  |     ///     .await?; | ||||||
|  |     /// # Ok(()) | ||||||
|  |     /// # } | ||||||
|  |     /// ``` | ||||||
|  |     /// | ||||||
|  |     /// # Errors | ||||||
|  |     /// | ||||||
|  |     /// This method fails if the passed value cannot be serialized into | ||||||
|  |     /// url encoded format | ||||||
|     pub fn form<T: Serialize + ?Sized>(mut self, form: &T) -> RequestBuilder { |     pub fn form<T: Serialize + ?Sized>(mut self, form: &T) -> RequestBuilder { | ||||||
|         let mut error = None; |         let mut error = None; | ||||||
|         if let Ok(ref mut req) = self.request { |         if let Ok(ref mut req) = self.request { | ||||||
|   | |||||||
| @@ -156,6 +156,15 @@ impl RequestBuilder { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     /// Send a form body. |     /// Send a form body. | ||||||
|  |     /// | ||||||
|  |     /// Sets the body to the url encoded serialization of the passed value, | ||||||
|  |     /// and also sets the `Content-Type: application/x-www-form-urlencoded` | ||||||
|  |     /// header. | ||||||
|  |     /// | ||||||
|  |     /// # Errors | ||||||
|  |     /// | ||||||
|  |     /// This method fails if the passed value cannot be serialized into | ||||||
|  |     /// url encoded format | ||||||
|     pub fn form<T: Serialize + ?Sized>(mut self, form: &T) -> RequestBuilder { |     pub fn form<T: Serialize + ?Sized>(mut self, form: &T) -> RequestBuilder { | ||||||
|         let mut error = None; |         let mut error = None; | ||||||
|         if let Ok(ref mut req) = self.request { |         if let Ok(ref mut req) = self.request { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user