@@ -480,7 +480,8 @@ func TestAuthenticatedRoute(t *testing.T) {
480480 t .Errorf ("unexpected Cache-Status header %v" , respAuthBypassAlice1 .Header .Get ("Cache-Status" ))
481481 }
482482 respAuthBypassAlice2 , _ := tester .AssertResponse (getRequestFor ("/auth-bypass" , "Alice" ), 200 , "Hello, auth bypass Bearer Alice!" )
483- if respAuthBypassAlice2 .Header .Get ("Cache-Status" ) != "Souin; hit; ttl=4; key=GET-http-localhost:9080-/auth-bypass-Bearer Alice-text/plain; detail=DEFAULT" {
483+ if respAuthBypassAlice2 .Header .Get ("Cache-Status" ) != "Souin; hit; ttl=4; key=GET-http-localhost:9080-/auth-bypass-Bearer Alice-text/plain; detail=DEFAULT" &&
484+ respAuthBypassAlice2 .Header .Get ("Cache-Status" ) != "Souin; hit; ttl=3; key=GET-http-localhost:9080-/auth-bypass-Bearer Alice-text/plain; detail=DEFAULT" {
484485 t .Errorf ("unexpected Cache-Status header %v" , respAuthBypassAlice2 .Header .Get ("Cache-Status" ))
485486 }
486487
@@ -489,7 +490,8 @@ func TestAuthenticatedRoute(t *testing.T) {
489490 t .Errorf ("unexpected Cache-Status header %v" , respAuthBypassBob1 .Header .Get ("Cache-Status" ))
490491 }
491492 respAuthBypassBob2 , _ := tester .AssertResponse (getRequestFor ("/auth-bypass" , "Bob" ), 200 , "Hello, auth bypass Bearer Bob!" )
492- if respAuthBypassBob2 .Header .Get ("Cache-Status" ) != "Souin; hit; ttl=4; key=GET-http-localhost:9080-/auth-bypass-Bearer Bob-text/plain; detail=DEFAULT" {
493+ if respAuthBypassBob2 .Header .Get ("Cache-Status" ) != "Souin; hit; ttl=4; key=GET-http-localhost:9080-/auth-bypass-Bearer Bob-text/plain; detail=DEFAULT" &&
494+ respAuthBypassBob2 .Header .Get ("Cache-Status" ) != "Souin; hit; ttl=3; key=GET-http-localhost:9080-/auth-bypass-Bearer Bob-text/plain; detail=DEFAULT" {
493495 t .Errorf ("unexpected Cache-Status header %v" , respAuthBypassBob2 .Header .Get ("Cache-Status" ))
494496 }
495497
@@ -498,7 +500,8 @@ func TestAuthenticatedRoute(t *testing.T) {
498500 t .Errorf ("unexpected Cache-Status header %v" , respAuthVaryBypassAlice1 .Header .Get ("Cache-Status" ))
499501 }
500502 respAuthVaryBypassAlice2 , _ := tester .AssertResponse (getRequestFor ("/auth-bypass-vary" , "Alice" ), 200 , "Hello, auth vary bypass Bearer Alice!" )
501- if respAuthVaryBypassAlice2 .Header .Get ("Cache-Status" ) != "Souin; hit; ttl=4; key=GET-http-localhost:9080-/auth-bypass-vary-Bearer Alice-text/plain; detail=DEFAULT" {
503+ if respAuthVaryBypassAlice2 .Header .Get ("Cache-Status" ) != "Souin; hit; ttl=4; key=GET-http-localhost:9080-/auth-bypass-vary-Bearer Alice-text/plain; detail=DEFAULT" &&
504+ respAuthVaryBypassAlice2 .Header .Get ("Cache-Status" ) != "Souin; hit; ttl=3; key=GET-http-localhost:9080-/auth-bypass-vary-Bearer Alice-text/plain; detail=DEFAULT" {
502505 t .Errorf ("unexpected Cache-Status header %v" , respAuthVaryBypassAlice2 .Header .Get ("Cache-Status" ))
503506 }
504507}
@@ -820,7 +823,7 @@ func (t *testVaryHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
820823 w .Header ().Set ("Vary" , variedHeader )
821824 w .Header ().Set (variedHeader , r .Header .Get (variedHeader ))
822825 w .WriteHeader (http .StatusOK )
823- _ , _ = w . Write ([] byte ( fmt .Sprintf ( "Hello, vary %s!" , r .Header .Get (variedHeader )) ))
826+ _ , _ = fmt .Fprintf ( w , "Hello, vary %s!" , r .Header .Get (variedHeader ))
824827}
825828
826829func TestVaryHandler (t * testing.T ) {
@@ -1178,7 +1181,8 @@ func TestExpires(t *testing.T) {
11781181 t .Errorf ("unexpected Age header %v" , resp1 .Header .Get ("Age" ))
11791182 }
11801183
1181- if resp1 .Header .Get ("Cache-Status" ) != fmt .Sprintf ("Souin; hit; ttl=%d; key=GET-http-localhost:9080-%s; detail=DEFAULT" , expectedDuration , path ) {
1184+ if resp1 .Header .Get ("Cache-Status" ) != fmt .Sprintf ("Souin; hit; ttl=%d; key=GET-http-localhost:9080-%s; detail=DEFAULT" , expectedDuration , path ) &&
1185+ resp1 .Header .Get ("Cache-Status" ) != fmt .Sprintf ("Souin; hit; ttl=%d; key=GET-http-localhost:9080-%s; detail=DEFAULT" , expectedDuration - 1 , path ) {
11821186 t .Errorf (
11831187 "unexpected second Cache-Status header %v, expected %s" ,
11841188 resp1 .Header .Get ("Cache-Status" ),
0 commit comments