-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide with_header
method on client
#108
Conversation
In the hyper documentation, they use plain strings as headers names/values: https://docs.rs/hyper/latest/hyper/struct.Request.html#examples
If there are optimizations made by HeaderName, and the custom headers will likely use some non-standard names ( From https://docs.rs/http/latest/http/header/struct.HeaderName.html#representation:
As I understand it, the custom header names are not represented as enums. |
LGTM, let's also pass to INSERTs |
src/lib.rs
Outdated
/// ``` | ||
pub fn with_header( | ||
mut self, | ||
name: impl Into<HeaderName>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can accept impl TryInto
to make it possible to pass strings. Downside here is that we cannot use HeaderMap
and should use HashMap<Result<_>, Result<_>>
instead =(
I rebased the code on the latest version and rewrote it to use plain |
LGTM, but need to fix rustfmt warnings |
This allows arbitrary headers to be included in requests to ClickHouse.
Merged, thanks for your contribution! |
This change allows arbitrary headers to be included in requests to ClickHouse.
It uses
HeaderName
andHeaderValue
which is efficient for use withhyper
. The types are provided by thehttp
crate to allow support for other HTTP client crates to use these types without requiring the fullhyper
crate.There are other ways to provide this capability, including unsealing the
HttpClient
trait to allow more implementations. However, this change provides a limited additional capability until a public interface forHttpClient
is decided.Fixes #98