From 02c6deaec8b9b021cd6d4899dac03da6e44fa483 Mon Sep 17 00:00:00 2001 From: houseme Date: Sun, 19 Dec 2021 00:18:18 +0800 Subject: [PATCH] feat:modify trace-ID to TraceID --- net/ghttp/ghttp.go | 5 +++-- net/ghttp/ghttp_response.go | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/net/ghttp/ghttp.go b/net/ghttp/ghttp.go index 0dd27cda4..c386a0b7b 100644 --- a/net/ghttp/ghttp.go +++ b/net/ghttp/ghttp.go @@ -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 ( diff --git a/net/ghttp/ghttp_response.go b/net/ghttp/ghttp_response.go index d1f0d041c..eb6f89ef1 100644 --- a/net/ghttp/ghttp_response.go +++ b/net/ghttp/ghttp_response.go @@ -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) }