docs: provide basic auth example (#1362)
This commit is contained in:
		
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							59bc9a9323
						
					
				
				
					commit
					be8ab7b951
				
			| @@ -228,6 +228,19 @@ impl RequestBuilder { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     /// Enable HTTP basic authentication. |     /// Enable HTTP basic authentication. | ||||||
|  |     /// | ||||||
|  |     /// ```rust | ||||||
|  |     /// # use reqwest::Error; | ||||||
|  |     /// | ||||||
|  |     /// # async fn run() -> Result<(), Error> { | ||||||
|  |     /// let client = reqwest::Client::new(); | ||||||
|  |     /// let resp = client.delete("http://httpbin.org/delete") | ||||||
|  |     ///     .basic_auth("admin", Some("good password")) | ||||||
|  |     ///     .send() | ||||||
|  |     ///     .await?; | ||||||
|  |     /// # Ok(()) | ||||||
|  |     /// # } | ||||||
|  |     /// ``` | ||||||
|     pub fn basic_auth<U, P>(self, username: U, password: Option<P>) -> RequestBuilder |     pub fn basic_auth<U, P>(self, username: U, password: Option<P>) -> RequestBuilder | ||||||
|     where |     where | ||||||
|         U: fmt::Display, |         U: fmt::Display, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user