From f8a04b6edb2a616334c2d50e107e1bdf87aa9a2e Mon Sep 17 00:00:00 2001 From: KarthikReddyPuli Date: Tue, 28 Nov 2023 01:30:29 +0530 Subject: [PATCH] fix: Add fullPath in context copy --- context.go | 1 + context_test.go | 2 ++ 2 files changed, 3 insertions(+) diff --git a/context.go b/context.go index 420ff167..b4a97c43 100644 --- a/context.go +++ b/context.go @@ -127,6 +127,7 @@ func (c *Context) Copy() *Context { paramCopy := make([]Param, len(cp.Params)) copy(paramCopy, cp.Params) cp.Params = paramCopy + cp.fullPath = c.fullPath return &cp } diff --git a/context_test.go b/context_test.go index 70d47583..2cb3d0e8 100644 --- a/context_test.go +++ b/context_test.go @@ -324,6 +324,7 @@ func TestContextCopy(t *testing.T) { c.handlers = HandlersChain{func(c *Context) {}} c.Params = Params{Param{Key: "foo", Value: "bar"}} c.Set("foo", "bar") + c.fullPath = "/hola" cp := c.Copy() assert.Nil(t, cp.handlers) @@ -336,6 +337,7 @@ func TestContextCopy(t *testing.T) { assert.Equal(t, cp.Params, c.Params) cp.Set("foo", "notBar") assert.False(t, cp.Keys["foo"] == c.Keys["foo"]) + assert.Equal(t, cp.fullPath, c.fullPath) } func TestContextHandlerName(t *testing.T) {