Strip MetadataKey global var
This commit is contained in:
parent
09caac9a80
commit
e2c1df3de6
@ -271,7 +271,7 @@ func (r *staticRouter) endpoint(req *http.Request) (*endpoint, error) {
|
|||||||
}
|
}
|
||||||
pMatch = true
|
pMatch = true
|
||||||
ctx := req.Context()
|
ctx := req.Context()
|
||||||
md, ok := ctx.Value(metadata.MetadataKey{}).(metadata.Metadata)
|
md, ok := metadata.FromContext(ctx)
|
||||||
if !ok {
|
if !ok {
|
||||||
md = make(metadata.Metadata)
|
md = make(metadata.Metadata)
|
||||||
}
|
}
|
||||||
@ -279,7 +279,7 @@ func (r *staticRouter) endpoint(req *http.Request) (*endpoint, error) {
|
|||||||
md[fmt.Sprintf("x-api-field-%s", k)] = v
|
md[fmt.Sprintf("x-api-field-%s", k)] = v
|
||||||
}
|
}
|
||||||
md["x-api-body"] = ep.apiep.Body
|
md["x-api-body"] = ep.apiep.Body
|
||||||
*req = *req.Clone(context.WithValue(ctx, metadata.MetadataKey{}, md))
|
*req = *req.Clone(metadata.NewContext(ctx, md))
|
||||||
break pathLoop
|
break pathLoop
|
||||||
}
|
}
|
||||||
if !pMatch {
|
if !pMatch {
|
||||||
|
Loading…
Reference in New Issue
Block a user