Skip to content

Commit

Permalink
docs: provide basic auth example (#1362)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeschkies committed Oct 21, 2021
1 parent 59bc9a9 commit be8ab7b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/async_impl/request.rs
Expand Up @@ -228,6 +228,19 @@ impl RequestBuilder {
}

/// 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
where
U: fmt::Display,
Expand Down

0 comments on commit be8ab7b

Please sign in to comment.