@@ -60,10 +60,9 @@ func NewRoundTripper(opts ...Option) http.RoundTripper {
|
||||
// RequestToContext puts the `Authorization` header bearer token into context
|
||||
// so calls to services will be authorized.
|
||||
func RequestToContext(r *http.Request) context.Context {
|
||||
ctx := context.Background()
|
||||
md := make(metadata.Metadata)
|
||||
md := metadata.New(len(r.Header))
|
||||
for k, v := range r.Header {
|
||||
md[k] = strings.Join(v, ",")
|
||||
md.Set(k, strings.Join(v, ","))
|
||||
}
|
||||
return metadata.NewContext(ctx, md)
|
||||
return metadata.NewIncomingContext(r.Context(), md)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user