feat:modify trace-ID to TraceID

This commit is contained in:
houseme
2021-12-19 00:18:18 +08:00
parent 63d384b676
commit 02c6deaec8
2 changed files with 4 additions and 3 deletions

View File

@ -12,12 +12,13 @@ import (
"reflect"
"time"
"github.com/gorilla/websocket"
"github.com/gogf/gf/v2/container/gmap"
"github.com/gogf/gf/v2/container/gtype"
"github.com/gogf/gf/v2/os/gcache"
"github.com/gogf/gf/v2/os/gsession"
"github.com/gogf/gf/v2/protocol/goai"
"github.com/gorilla/websocket"
)
type (
@ -132,7 +133,7 @@ const (
contentTypeHtml = "text/html"
contentTypeJson = "application/json"
swaggerUIPackedPath = "/goframe/swaggerui"
responseTraceIdHeader = "Trace-Id"
responseTraceIDHeader = "TraceID"
)
var (

View File

@ -143,7 +143,7 @@ func (r *Response) ClearBuffer() {
// Flush outputs the buffer content to the client and clears the buffer.
func (r *Response) Flush() {
r.Header().Set(responseTraceIdHeader, gtrace.GetTraceID(r.Request.Context()))
r.Header().Set(responseTraceIDHeader, gtrace.GetTraceID(r.Request.Context()))
if r.Server.config.ServerAgent != "" {
r.Header().Set("Server", r.Server.config.ServerAgent)
}