@@ -190,8 +190,8 @@ func TestProxy_PassesThroughNonGET(t *testing.T) {
190190
191191func TestProxy_DefaultUpstream (t * testing.T ) {
192192 // Verify that the cache key includes the default upstream.
193- key := cacheKey (defaultUpstream , "/repos/owner/repo" , "" , "" )
194- if key != "https://api.github.com|/repos/owner/repo|| " {
193+ key := cacheKey (defaultUpstream , "/repos/owner/repo" , "" )
194+ if key != "https://api.github.com|/repos/owner/repo|" {
195195 t .Fatalf ("unexpected cache key: %s" , key )
196196 }
197197}
@@ -319,21 +319,16 @@ func TestProxy_AllowsConfiguredUpstream(t *testing.T) {
319319 }
320320}
321321
322- func TestCacheKeyVariesByAcceptAndAuthorization (t * testing.T ) {
323- key1 := cacheKey (defaultUpstream , "/repos/o/r/issues" , "application/json" , "token one" )
324- key2 := cacheKey (defaultUpstream , "/repos/o/r/issues" , "application/vnd.github.raw+json" , "token one" )
325- key3 := cacheKey (defaultUpstream , "/repos/o/r/issues" , "application/json" , "token two" )
322+ func TestCacheKeyVariesByAcceptNotAuthorization (t * testing.T ) {
323+ key1 := cacheKey (defaultUpstream , "/repos/o/r/issues" , "application/json" )
324+ key2 := cacheKey (defaultUpstream , "/repos/o/r/issues" , "application/vnd.github.raw+json" )
326325
327326 if key1 == key2 {
328327 t .Fatal ("expected cache key to vary by Accept header" )
329328 }
330- if key1 == key3 {
331- t .Fatal ("expected cache key to vary by Authorization header " )
329+ if key1 != cacheKey ( defaultUpstream , "/repos/o/r/issues" , "application/json" ) {
330+ t .Fatal ("expected cache key to be stable for identical inputs " )
332331 }
333- if key1 == cacheKey (defaultUpstream , "/repos/o/r/issues" , "application/json" , "token one" ) {
334- return
335- }
336- t .Fatal ("expected cache key to be stable for identical inputs" )
337332}
338333
339334func TestRewriteLinkHeader (t * testing.T ) {
0 commit comments