zeroshade commented on code in PR #387:
URL: https://github.com/apache/arrow-adbc/pull/387#discussion_r1087100921
##########
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:
I like not having it reflect the new header. whatever headers exist at the
moment of creation should propagate, but subsequent changes shouldn't propagate
(same for connections and statements).
The updated commit and tests demonstrate this and show it.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]