File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ export type ConnectionOptions = {
6262 readonly session ?: Session ;
6363 readonly extraCredential ?: ExtraCredential ;
6464 readonly ssl ?: SecureContextOptions ;
65+ readonly extraHeaders ?: RequestHeaders ;
6566} ;
6667
6768export type QueryStage = {
@@ -192,6 +193,7 @@ class Client {
192193 [ TRINO_EXTRA_CREDENTIAL_HEADER ] : encodeAsString (
193194 options . extraCredential ?? { }
194195 ) ,
196+ ...( options . extraHeaders ?? { } ) ,
195197 } ;
196198
197199 if ( options . auth && options . auth . type === 'basic' ) {
Original file line number Diff line number Diff line change @@ -71,6 +71,22 @@ describe('trino', () => {
7171 expect ( info . query ) . toBe ( singleCustomerQuery ) ;
7272 } ) ;
7373
74+ test . concurrent ( 'client extra header propagation' , async ( ) => {
75+ const source = 'new-client' ;
76+ const trino = Trino . create ( {
77+ catalog : 'tpcds' ,
78+ schema : 'sf100000' ,
79+ auth : new BasicAuth ( 'test' ) ,
80+ extraHeaders : { 'X-Trino-Source' : source } ,
81+ } ) ;
82+
83+ const query = await trino . query ( singleCustomerQuery ) ;
84+ const qr = await query . next ( ) ;
85+
86+ const info : any = await trino . queryInfo ( qr . value . id ) ;
87+ expect ( info . session . source ) . toBe ( source ) ;
88+ } ) ;
89+
7490 test . concurrent ( 'query request header propagation' , async ( ) => {
7591 const trino = Trino . create ( { catalog : 'tpcds' , auth : new BasicAuth ( 'test' ) } ) ;
7692 const query = await trino . query ( useSchemaQuery ) ;
You can’t perform that action at this time.
0 commit comments