提交 762218a7 authored 作者: mooncake9527's avatar mooncake9527

request cost

上级 5198625a
......@@ -23,7 +23,7 @@ const (
KeyShopID = "shopID"
KeyUName = "uname"
KeyToken = "token"
KeyCost = "cost"
KeyCost = "X-Request-Cose"
)
var (
......
......@@ -387,6 +387,15 @@ func (req *Request) send(ctx context.Context, body io.Reader, buf *bytes.Buffer)
logger.Error("httpCli fail", logger.Any("err", err), ctxUtils.CtxTraceIDField(ctx))
}
if resp != nil {
if resp.Header != nil {
ginCtx, _ := ctxUtils.GetGinCtx(ctx)
if ginCtx != nil {
ginCtx.Writer.Header().Add(ctxUtils.KeyCost, resp.Header.Get(ctxUtils.KeyCost))
}
}
}
req.response = resp
req.err = err
resp.err = err
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论