MCPcopy
hub / github.com/gofiber/fiber / Test_Ctx_RenderWithoutLocals

Function Test_Ctx_RenderWithoutLocals

ctx_test.go:7537–7549  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7535}
7536
7537func Test_Ctx_RenderWithoutLocals(t *testing.T) {
7538 t.Parallel()
7539 app := New(Config{
7540 PassLocalsToViews: false,
7541 })
7542 c := app.AcquireCtx(&fasthttp.RequestCtx{})
7543
7544 c.Locals("Title", "Hello, World!")
7545
7546 err := c.Render("./.github/testdata/index.tmpl", Map{})
7547 require.NoError(t, err)
7548 require.Equal(t, "<h1></h1>", string(c.Response().Body()))
7549}
7550
7551func Test_Ctx_RenderWithLocals(t *testing.T) {
7552 t.Parallel()

Callers

nothing calls this directly

Calls 6

AcquireCtxMethod · 0.80
NewFunction · 0.70
LocalsMethod · 0.65
RenderMethod · 0.65
BodyMethod · 0.65
ResponseMethod · 0.65

Tested by

no test coverage detected