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


##########
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:
   So, if you look at the way it's implemented, the copy here just makes it so 
that changes to the *database* header options won't propagate to children. But 
changes to the connection's headers *will* propagate to child statements (which 
is what you expected in the dropped C++ tests). My original implementation also 
did a copy from the connection's headers to a statement, but I changed it back 
when I implemented the tests copying the ones from the dropped C++ impl



-- 
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