Home / Function/ Test_Ctx_Append() — fiber Function Reference

Test_Ctx_Append() — fiber Function Reference

Architecture documentation for the Test_Ctx_Append() function in ctx_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  239dc647_3f78_1651_9e86_0dab74b3d0da["Test_Ctx_Append()"]
  7b3d4933_5ae3_f84d_ff6d_0cb34e268026["ctx_test.go"]
  239dc647_3f78_1651_9e86_0dab74b3d0da -->|defined in| 7b3d4933_5ae3_f84d_ff6d_0cb34e268026
  style 239dc647_3f78_1651_9e86_0dab74b3d0da fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

ctx_test.go lines 635–668

func Test_Ctx_Append(t *testing.T) {
	t.Parallel()
	app := New()
	c := app.AcquireCtx(&fasthttp.RequestCtx{})

	c.Append("X-Test", "Hello")
	c.Append("X-Test", "World")
	c.Append("X-Test", "Hello", "World")
	// similar value in the middle
	c.Append("X2-Test", "World")
	c.Append("X2-Test", "XHello")
	c.Append("X2-Test", "Hello", "World")
	// similar value at the start
	c.Append("X3-Test", "XHello")
	c.Append("X3-Test", "World")
	c.Append("X3-Test", "Hello", "World")
	// try it with multiple similar values
	c.Append("X4-Test", "XHello")
	c.Append("X4-Test", "Hello")
	c.Append("X4-Test", "HelloZ")
	c.Append("X4-Test", "YHello")
	c.Append("X4-Test", "Hello")
	c.Append("X4-Test", "YHello")
	c.Append("X4-Test", "HelloZ")
	c.Append("X4-Test", "XHello")
	// without append value
	c.Append("X-Custom-Header")

	require.Equal(t, "Hello, World", string(c.Response().Header.Peek("X-Test")))
	require.Equal(t, "World, XHello, Hello", string(c.Response().Header.Peek("X2-Test")))
	require.Equal(t, "XHello, World, Hello", string(c.Response().Header.Peek("X3-Test")))
	require.Equal(t, "XHello, Hello, HelloZ, YHello", string(c.Response().Header.Peek("X4-Test")))
	require.Empty(t, string(c.Response().Header.Peek("x-custom-header")))
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does Test_Ctx_Append() do?
Test_Ctx_Append() is a function in the fiber codebase, defined in ctx_test.go.
Where is Test_Ctx_Append() defined?
Test_Ctx_Append() is defined in ctx_test.go at line 635.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free