Closed hashworks closed 6 years ago
Otherwise one could always cause cache misses by adding various GET query parameters like ?foo=1.
?foo=1
func TestCachePageWithoutQuery(t *testing.T) { store := persistence.NewInMemoryStore(60 * time.Second) router := gin.New() router.GET("/cache_without_query", CachePageWithoutQuery(store, time.Second*3, func(c *gin.Context) { c.String(200, "pong "+fmt.Sprint(time.Now().UnixNano())) })) w1 := performRequest("GET", "/cache_without_query?foo=1", router) w2 := performRequest("GET", "/cache_without_query?foo=2", router) assert.Equal(t, 200, w1.Code) assert.Equal(t, 200, w2.Code) assert.Equal(t, w1.Body.String(), w2.Body.String()) }
See https://github.com/gin-contrib/cache/pull/42
Otherwise one could always cause cache misses by adding various GET query parameters like
?foo=1
.