File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -45,10 +45,23 @@ func TestSetRequestIdWitoutIncomingHeader(t *testing.T) {
4545 handlerToTest .ServeHTTP (httptest .NewRecorder (), req )
4646}
4747
48+ import (
49+ "context"
50+ "net/http"
51+ "net/http/httptest"
52+ "testing"
53+
54+ "github.com/platform-mesh/golang-commons/context/keys"
55+ "github.com/platform-mesh/golang-commons/logger"
56+ "github.com/stretchr/testify/assert"
57+ )
58+
4859func TestSetRequestIdInLogger (t * testing.T ) {
4960 // This test verifies that SetRequestIdInLogger creates a request-aware logger
5061 nextHandler := http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
5162 // The logger in context should be updated with request information
63+ log := logger .LoadLoggerFromContext (r .Context ())
64+ assert .NotNil (t , log )
5265 w .WriteHeader (http .StatusOK )
5366 })
5467
You can’t perform that action at this time.
0 commit comments