@@ -8,6 +8,7 @@ extern crate static_assertions;
88
99use std:: { collections:: HashMap , sync:: Arc , time:: Duration } ;
1010
11+ use http:: { HeaderMap , HeaderName , HeaderValue } ;
1112use hyper:: client:: connect:: HttpConnector ;
1213#[ cfg( feature = "tls" ) ]
1314use hyper_tls:: HttpsConnector ;
@@ -57,6 +58,7 @@ pub struct Client {
5758 password : Option < String > ,
5859 compression : Compression ,
5960 options : HashMap < String , String > ,
61+ headers : HeaderMap ,
6062}
6163
6264impl Default for Client {
@@ -93,6 +95,7 @@ impl Client {
9395 password : None ,
9496 compression : Compression :: default ( ) ,
9597 options : HashMap :: new ( ) ,
98+ headers : HeaderMap :: new ( ) ,
9699 }
97100 }
98101
@@ -170,6 +173,22 @@ impl Client {
170173 self
171174 }
172175
176+ /// Used to specify a header that will be passed to all queries.
177+ ///
178+ /// # Example
179+ /// ```
180+ /// # use clickhouse::Client;
181+ /// Client::default().with_option("allow_nondeterministic_mutations", "1");
182+ /// ```
183+ pub fn with_header (
184+ mut self ,
185+ name : impl Into < HeaderName > ,
186+ value : impl Into < HeaderValue > ,
187+ ) -> Self {
188+ self . headers . append ( name. into ( ) , value. into ( ) ) ;
189+ self
190+ }
191+
173192 /// Starts a new INSERT statement.
174193 ///
175194 /// # Panics
0 commit comments