1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-17 18:07:01 +00:00

new handlers for client (i.e browser) catching: cache.NoCache and cache.StaticCache including tests

Former-commit-id: 18975297c8b96c7f9d5ff757f92051f6b10933c1
This commit is contained in:
speedwheel
2018-03-17 06:15:13 +02:00
parent bc45e6444c
commit 50164f082c
6 changed files with 206 additions and 42 deletions

5
cache/cache_test.go vendored
View File

@@ -7,6 +7,7 @@ import (
"time"
"github.com/kataras/iris/cache"
"github.com/kataras/iris/cache/client"
"github.com/kataras/iris/cache/client/rule"
"github.com/kataras/iris"
@@ -84,7 +85,7 @@ func runTest(e *httpexpect.Expect, path string, counterPtr *uint32, expectedBody
return nil
}
func TestNoCache(t *testing.T) {
func TestClientNoCache(t *testing.T) {
app := iris.New()
var n uint32
@@ -94,7 +95,7 @@ func TestNoCache(t *testing.T) {
})
app.Get("/nocache", cache.Handler(cacheDuration), func(ctx context.Context) {
cache.NoCache(ctx) // <----
client.NoCache(ctx) // <----
atomic.AddUint32(&n, 1)
ctx.Write([]byte(expectedBodyStr))
})