MCPcopy Create free account
hub / github.com/kataras/iris / TestClientNoCache

Function TestClientNoCache

cache/cache_test.go:96–115  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

94}
95
96func TestClientNoCache(t *testing.T) {
97 app := iris.New()
98 var n uint32
99
100 app.Get("/", cache.Handler(cacheDuration), func(ctx *context.Context) {
101 atomic.AddUint32(&n, 1)
102 ctx.Write([]byte(expectedBodyStr))
103 })
104
105 app.Get("/nocache", cache.Handler(cacheDuration), func(ctx *context.Context) {
106 client.NoCache(ctx) // <----
107 atomic.AddUint32(&n, 1)
108 ctx.Write([]byte(expectedBodyStr))
109 })
110
111 e := httptest.New(t, app)
112 if err := runTest(e, "/", &n, expectedBodyStr, "/nocache"); err != nil {
113 t.Fatalf(t.Name()+": %v", err)
114 }
115}
116
117func TestCache(t *testing.T) {
118 app := iris.New()

Callers

nothing calls this directly

Calls 9

HandlerFunction · 0.92
NoCacheFunction · 0.92
NewFunction · 0.92
runTestFunction · 0.85
NewMethod · 0.80
FatalfMethod · 0.80
GetMethod · 0.65
NameMethod · 0.65
WriteMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…