File tree 2 files changed +18
-0
lines changed
2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ export type ConnectionOptions = {
62
62
readonly session ?: Session ;
63
63
readonly extraCredential ?: ExtraCredential ;
64
64
readonly ssl ?: SecureContextOptions ;
65
+ readonly extraHeaders ?: RequestHeaders ;
65
66
} ;
66
67
67
68
export type QueryStage = {
@@ -192,6 +193,7 @@ class Client {
192
193
[ TRINO_EXTRA_CREDENTIAL_HEADER ] : encodeAsString (
193
194
options . extraCredential ?? { }
194
195
) ,
196
+ ...( options . extraHeaders ?? { } ) ,
195
197
} ;
196
198
197
199
if ( options . auth && options . auth . type === 'basic' ) {
Original file line number Diff line number Diff line change @@ -71,6 +71,22 @@ describe('trino', () => {
71
71
expect ( info . query ) . toBe ( singleCustomerQuery ) ;
72
72
} ) ;
73
73
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
+
74
90
test . concurrent ( 'query request header propagation' , async ( ) => {
75
91
const trino = Trino . create ( { catalog : 'tpcds' , auth : new BasicAuth ( 'test' ) } ) ;
76
92
const query = await trino . query ( useSchemaQuery ) ;
You can’t perform that action at this time.
0 commit comments