lidavidm commented on code in PR #387:
URL: https://github.com/apache/arrow-adbc/pull/387#discussion_r1087091293


##########
go/adbc/driver/flightsql/flightsql_adbc.go:
##########
@@ -204,19 +227,16 @@ func (d *database) SetOptions(cnOptions 
map[string]string) error {
 }
 
 type bearerAuthMiddleware struct {
-       token string
+       hdrs metadata.MD
 }
 
 func (b *bearerAuthMiddleware) StartCall(ctx context.Context) context.Context {
-       if b.token != "" {
-               return metadata.AppendToOutgoingContext(ctx, "authorization", 
b.token)
-       }
-
-       return ctx
+       md, _ := metadata.FromOutgoingContext(ctx)
+       return metadata.NewOutgoingContext(ctx, metadata.Join(md, b.hdrs))
 }
 
 func getFlightClient(ctx context.Context, loc string, d *database) 
(*flightsql.Client, error) {
-       authMiddle := &bearerAuthMiddleware{}
+       authMiddle := &bearerAuthMiddleware{hdrs: d.hdrs.Copy()}

Review Comment:
   If you look at the old C++ implementation, statements had a strong reference 
to connections and connections had a strong reference to databases, so each 
call walked the chain of references and built up the final dictionary of 
headers dynamically - that's what was behind the behavior in those C++ tests 
you saw



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to