diff --git a/pkg/app/context.go b/pkg/app/context.go index 510c9725f..91b5e0da5 100644 --- a/pkg/app/context.go +++ b/pkg/app/context.go @@ -795,6 +795,7 @@ func (ctx *RequestContext) Copy() *RequestContext { paramCopy := make([]param.Param, len(cp.Params)) copy(paramCopy, cp.Params) cp.Params = paramCopy + cp.fullPath = ctx.fullPath cp.clientIPFunc = ctx.clientIPFunc cp.formValueFunc = ctx.formValueFunc cp.binder = ctx.binder diff --git a/pkg/app/context_test.go b/pkg/app/context_test.go index 85d686c08..7cbe71c7d 100644 --- a/pkg/app/context_test.go +++ b/pkg/app/context_test.go @@ -220,6 +220,7 @@ func TestGet(t *testing.T) { func TestCopy(t *testing.T) { t.Parallel() ctx := NewContext(0) + ctx.fullPath = "full_path" ctx.Request.Header.Add("header_a", "header_value_a") ctx.Response.Header.Add("header_b", "header_value_b") ctx.Params = param.Params{ @@ -244,6 +245,11 @@ func TestCopy(t *testing.T) { return } + if c.fullPath != "full_path" { + t.Errorf("unexpected value: %#v, expected: %#v", c.fullPath, "full_path") + return + } + reqHeaderStr := context.Request.Header.Get("header_a") if reqHeaderStr != "header_value_a" { t.Errorf("unexpected value: %#v, expected: %#v", reqHeaderStr, "header_value_a")