Example #1
0
func TestVaryKey(t *testing.T) {
	r := newRequest("GET", "http://x.org/test", "Llamas-1: true", "Llamas-2: false")

	k1 := httpcache.NewRequestKey(r)
	k2 := httpcache.NewRequestKey(r).Vary("Llamas-1, Llamas-2", r)

	assert.NotEqual(t, k1.String(), k2.String())
}
Example #2
0
func TestRequestKeyWithIllegalContentLocation(t *testing.T) {
	r := newRequest("GET", "http://x.org/test1", "Content-Location: http://y.org/test2")

	k1 := httpcache.NewKey("GET", mustParseUrl("http://x.org/test1"), nil)
	k2 := httpcache.NewRequestKey(r)

	assert.Equal(t, k1.String(), k2.String())
}
Example #3
0
func TestRequestKey(t *testing.T) {
	r := newRequest("GET", "http://x.org/test")

	k1 := httpcache.NewKey("GET", mustParseUrl("http://x.org/test"), nil)
	k2 := httpcache.NewRequestKey(r)

	assert.Equal(t, k1.String(), k2.String())
}