go test -run Test_Ctx_FullURL_DoesNotAliasPooledBuffer
(t *testing.T)
| 262 | |
| 263 | // go test -run Test_Ctx_FullURL_DoesNotAliasPooledBuffer |
| 264 | func Test_Ctx_FullURL_DoesNotAliasPooledBuffer(t *testing.T) { |
| 265 | t.Parallel() |
| 266 | |
| 267 | const bufferPoolReuseAttempts = 128 |
| 268 | |
| 269 | app := New() |
| 270 | c := app.AcquireCtx(&fasthttp.RequestCtx{}) |
| 271 | |
| 272 | c.Request().Header.SetHost("example.com") |
| 273 | c.Request().SetRequestURI("/search?q=fiber") |
| 274 | |
| 275 | fullURL := c.FullURL() |
| 276 | require.Equal(t, "http://example.com/search?q=fiber", fullURL) |
| 277 | |
| 278 | for range bufferPoolReuseAttempts { |
| 279 | buf := bytebufferpool.Get() |
| 280 | buf.Reset() |
| 281 | buf.WriteString("https://mutated.example/rewritten") |
| 282 | bytebufferpool.Put(buf) |
| 283 | } |
| 284 | |
| 285 | require.Equal(t, "http://example.com/search?q=fiber", fullURL) |
| 286 | } |
| 287 | |
| 288 | // go test -run Test_Ctx_TypedParsingDefaults |
| 289 | func Test_Ctx_TypedParsingDefaults(t *testing.T) { |
nothing calls this directly
no test coverage detected