Skip to content
Myr

fix(route): Add fullPath in context copy (#3784)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* fix: Add fullPath in context copy * Update context.go ---------

authored by Karthik Reddy Puli · committed by GitHub · parent f75144a · Browse files · 2 files+3 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>

Diff stats

2 files+3 added−0 removed

  • other:+3 added−0 removed

2 files+3 added−0 removed

modified:context_test.go+2 added
322 unmodified lines
323 c.Request, _ = http.NewRequest("POST", "/hola", nil)324 c.handlers = HandlersChain{func(c *Context) {}}325 c.Params = Params{Param{Key: "foo", Value: "bar"}}326 c.Set("foo", "bar")327 c.fullPath = "/hola"328329 cp := c.Copy()330 assert.Nil(t, cp.handlers)331 assert.Nil(t, cp.writermem.ResponseWriter)
4 unmodified lines
336 assert.Equal(t, cp.engine, c.engine)337 assert.Equal(t, cp.Params, c.Params)338 cp.Set("foo", "notBar")339 assert.False(t, cp.Keys["foo"] == c.Keys["foo"])340 assert.Equal(t, cp.fullPath, c.fullPath)341}342343func TestContextHandlerName(t *testing.T) {344 c, _ := CreateTestContext(httptest.NewRecorder())
2112 unmodified lines
modified:context.go+1 added
118 unmodified lines
119 cp.writermem.ResponseWriter = nil120 cp.Writer = &cp.writermem121 cp.index = abortIndex122 cp.handlers = nil123 cp.fullPath = c.fullPath124125 cKeys := c.Keys126 cp.Keys = make(map[string]any, len(cKeys))127 for k, v := range cKeys {
1111 unmodified lines