Skip to content

Commit

Permalink
Remove duplicate example for ClientBuilder::default_headers (#2236)
Browse files Browse the repository at this point in the history
* Remove duplicate example for ClientBuilder::default_headers

* Remove duplicate example for ClientBuilder::default_headers (blocking)
  • Loading branch information
Kriskras99 authored Apr 5, 2024
1 parent e3a1565 commit 9209695
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 41 deletions.
21 changes: 0 additions & 21 deletions src/async_impl/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -807,27 +807,6 @@ impl ClientBuilder {
/// # Ok(())
/// # }
/// ```
///
/// Override the default headers:
///
/// ```rust
/// use reqwest::header;
/// # async fn doc() -> Result<(), reqwest::Error> {
/// let mut headers = header::HeaderMap::new();
/// headers.insert("X-MY-HEADER", header::HeaderValue::from_static("value"));
///
/// // get a client builder
/// let client = reqwest::Client::builder()
/// .default_headers(headers)
/// .build()?;
/// let res = client
/// .get("https://www.rust-lang.org")
/// .header("X-MY-HEADER", "new_value")
/// .send()
/// .await?;
/// # Ok(())
/// # }
/// ```
pub fn default_headers(mut self, headers: HeaderMap) -> ClientBuilder {
for (key, value) in headers.iter() {
self.config.headers.insert(key, value.clone());
Expand Down
20 changes: 0 additions & 20 deletions src/blocking/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,26 +157,6 @@ impl ClientBuilder {
/// # Ok(())
/// # }
/// ```
///
/// Override the default headers:
///
/// ```rust
/// use reqwest::header;
/// # fn build_client() -> Result<(), reqwest::Error> {
/// let mut headers = header::HeaderMap::new();
/// headers.insert("X-MY-HEADER", header::HeaderValue::from_static("value"));
///
/// // get a client builder
/// let client = reqwest::blocking::Client::builder()
/// .default_headers(headers)
/// .build()?;
/// let res = client
/// .get("https://www.rust-lang.org")
/// .header("X-MY-HEADER", "new_value")
/// .send()?;
/// # Ok(())
/// # }
/// ```
pub fn default_headers(self, headers: header::HeaderMap) -> ClientBuilder {
self.with_inner(move |inner| inner.default_headers(headers))
}
Expand Down

0 comments on commit 9209695

Please sign in to comment.