You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i trid this, it is not work,
for example, i wanna pass Accept-Language or Language or any other header to service.
it is cant pass.
err = conn.Invoke(callCtx(c), "/"+s.GrpcCall.gw.Service+"."+s.GrpcCall.gw.Endpoint, request, response)
func callCtx(c *gin.Context) context.Context {
r := c.Request
// create context
myContext := ctx.FromRequest(r)
// get context from http handler wrappers
md, ok := metadata.FromContext(r.Context())
if !ok {
md = make(metadata.Metadata)
}
// fill contex with http headers
md["Host"] = r.Host
md["Method"] = r.Method
// get canonical headers
for k := range r.Header {
// may be need to get all values for key like r.Header.Values() provide in go 1.14
md[textproto.CanonicalMIMEHeaderKey(k)] = r.Header.Get(k)
}
// merge context with overwrite
myContext = metadata.MergeContext(myContext, md, true)
return myContext
}
The text was updated successfully, but these errors were encountered:
i trid this, it is not work,
for example, i wanna pass Accept-Language or Language or any other header to service.
it is cant pass.
The text was updated successfully, but these errors were encountered: