feat(client): add support for title case header names (#1497)

This introduces support for the HTTP/1 Client to write header names as title case when encoding
the request.

Closes #1492
This commit is contained in:
Matt Bilker
2018-04-24 19:41:02 -04:00
committed by Sean McArthur
parent 2cd46664d5
commit a02fec8c78
6 changed files with 174 additions and 4 deletions

View File

@@ -67,6 +67,7 @@ where
pub struct Builder {
exec: Exec,
h1_writev: bool,
h1_title_case_headers: bool,
http2: bool,
}
@@ -419,6 +420,7 @@ impl Builder {
Builder {
exec: Exec::Default,
h1_writev: true,
h1_title_case_headers: false,
http2: false,
}
}
@@ -435,6 +437,11 @@ impl Builder {
self
}
pub(super) fn h1_title_case_headers(&mut self, enabled: bool) -> &mut Builder {
self.h1_title_case_headers = enabled;
self
}
/// Sets whether HTTP2 is required.
///
/// Default is false.
@@ -550,6 +557,9 @@ where
if !self.builder.h1_writev {
conn.set_write_strategy_flatten();
}
if self.builder.h1_title_case_headers {
conn.set_title_case_headers();
}
let cd = proto::h1::dispatch::Client::new(rx);
let dispatch = proto::h1::Dispatcher::new(cd, conn);
Either::A(dispatch)