ARROW-12746: [Go][Flight] append instead of overwriting outgoing metadata#10297
ARROW-12746: [Go][Flight] append instead of overwriting outgoing metadata#10297zeroshade wants to merge 1 commit intoapache:masterfrom
Conversation
|
@emkornfield another small bug fix that I found during some work |
| return status.Errorf(codes.Unauthenticated, "error retrieving token: %s", err) | ||
| } | ||
|
|
||
| return invoker(metadata.NewOutgoingContext(ctx, metadata.Pairs(grpcAuthHeader, tok)), method, req, reply, cc, opts...) |
There was a problem hiding this comment.
its not clear to me why append and not overwrite is the right thing here?
There was a problem hiding this comment.
the ctx variable passed in is the "context" that was created by the caller and passed. The user could add metadata (ie: headers) to the context by calling NewOutgoingContext. The problem is that by calling NewOutgoingContext here, we're dropping any metadata they had stuck in the context and replacing it with the auth metadata. So they're gonna lose any extra headers/metadata a caller intended on passing with the request.
By calling AppendToOutgoingContext if there is no metadata it'll create some, but if there already is metadata in the context that was placed there by the caller, we're just gonna add the authentication header to the metadata, preserving the caller's metadata instead of dropping it completely.
…data Closes apache#10297 from zeroshade/flight-client-metadata Authored-by: Matthew Topol <[email protected]> Signed-off-by: Micah Kornfield <[email protected]>
No description provided.