예제 #1
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())
}
예제 #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())
}
예제 #3
0
func TestKeysDiffer(t *testing.T) {
	k1 := httpcache.NewKey("GET", mustParseUrl("http://x.org/test"), nil)
	k2 := httpcache.NewKey("GET", mustParseUrl("http://y.org/test"), nil)

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