Merge pull request #103 from carllerche/remove-headers-builder

Remove Builder::headers
This commit is contained in:
Alex Crichton
2017-08-08 07:44:21 +08:00
committed by GitHub
2 changed files with 0 additions and 72 deletions
-36
View File
@@ -619,42 +619,6 @@ impl Builder {
self
}
/// Appends a list of headersc to this request builder.
///
/// This function will append the provided key/value pairs to the internal
/// `HeaderMap` being constructed. Essentially this is equivalent to calling
/// `HeaderMap::append` a number of times.
///
/// # Examples
///
/// ```
/// # use http::*;
///
/// let mut headers = vec![
/// ("X-Custom-Foo", "bar"),
/// ];
///
/// if needs_custom_bar_header() {
/// headers.push(("X-Custom-Bar", "another"));
/// }
///
/// let req = Request::builder()
/// .headers(headers)
/// .body(())
/// .unwrap();
/// # fn needs_custom_bar_header() -> bool { true }
/// ```
pub fn headers<I, K, V>(&mut self, headers: I) -> &mut Builder
where I: IntoIterator<Item = (K, V)>,
K: HeaderMapKey,
HeaderValue: HttpTryFrom<V>,
{
for (key, value) in headers {
self.header(key, value);
}
self
}
/// Adds an extension to this builder
///
/// # Examples
-36
View File
@@ -585,42 +585,6 @@ impl Builder {
self
}
/// Appends a list of headersc to this response builder.
///
/// This function will append the provided key/value pairs to the internal
/// `HeaderMap` being constructed. Essentially this is equivalent to calling
/// `HeaderMap::append` a number of times.
///
/// # Examples
///
/// ```
/// # use http::*;
///
/// let mut headers = vec![
/// ("X-Custom-Foo", "bar"),
/// ];
///
/// if needs_custom_bar_header() {
/// headers.push(("X-Custom-Bar", "another"));
/// }
///
/// let response = Response::builder()
/// .headers(headers)
/// .body(())
/// .unwrap();
/// # fn needs_custom_bar_header() -> bool { true }
/// ```
pub fn headers<I, K, V>(&mut self, headers: I) -> &mut Builder
where I: IntoIterator<Item = (K, V)>,
K: HeaderMapKey,
HeaderValue: HttpTryFrom<V>,
{
for (key, value) in headers {
self.header(key, value);
}
self
}
/// Adds an extension to this builder
///
/// # Examples