@@ -95,7 +95,7 @@ def test_evaluate_conditional_request(self):
9595 """Tests COMPRESS_EVALUATE_CONDITIONAL_REQUEST default value
9696 is correctly set."""
9797 self .assertEqual (
98- self .app .config ["COMPRESS_EVALUATE_CONDITIONAL_REQUEST" ], False
98+ self .app .config ["COMPRESS_EVALUATE_CONDITIONAL_REQUEST" ], True
9999 )
100100
101101
@@ -633,6 +633,7 @@ def test_weak_etag_is_preserved(self):
633633 self .assertEqual (tag , "abc123" )
634634
635635 def test_conditional_get_uses_strong_compressed_representation (self ):
636+ self .app .config ["COMPRESS_EVALUATE_CONDITIONAL_REQUEST" ] = False
636637 client = self .app .test_client ()
637638 r1 = client .get ("/strong/" , headers = [("Accept-Encoding" , "gzip" )])
638639
@@ -643,12 +644,13 @@ def test_conditional_get_uses_strong_compressed_representation(self):
643644 ("If-None-Match" , r1 .headers ["ETag" ]),
644645 ],
645646 )
646- # This is the current behavior that breaks make_conditional
647+ # This is the old behavior that broke make_conditional
647648 # strong etags due rewrite at after_request
648649 # We would expect a 304 but it does not because of etag mismatch
649650 self .assertEqual (r2 .status_code , 200 )
650651
651652 def test_conditional_get_uses_weak_compressed_representation (self ):
653+ self .app .config ["COMPRESS_EVALUATE_CONDITIONAL_REQUEST" ] = False
652654 client = self .app .test_client ()
653655 r1 = client .get ("/weak/" , headers = [("Accept-Encoding" , "gzip" )])
654656 etag_header = r1 .headers ["ETag" ]
@@ -657,7 +659,7 @@ def test_conditional_get_uses_weak_compressed_representation(self):
657659 "/weak/" ,
658660 headers = [("Accept-Encoding" , "gzip" ), ("If-None-Match" , etag_header )],
659661 )
660- # This is the new behaviour we would expect by not mutating
662+ # This is the behaviour we expect by not mutating
661663 # the weak etags at after_request
662664 self .assertEqual (r2 .status_code , 304 )
663665 self .assertEqual (r2 .headers .get ("ETag" ), etag_header )
@@ -667,7 +669,6 @@ def test_conditional_get_uses_weak_compressed_representation(self):
667669 def test_conditional_get_uses_strong_compressed_representation_evaluate_conditional (
668670 self ,
669671 ):
670- self .app .config ["COMPRESS_EVALUATE_CONDITIONAL_REQUEST" ] = True
671672 client = self .app .test_client ()
672673 r1 = client .get (
673674 "/strong-compress-conditional/" , headers = [("Accept-Encoding" , "gzip" )]
@@ -678,7 +679,7 @@ def test_conditional_get_uses_strong_compressed_representation_evaluate_conditio
678679 "/strong-compress-conditional/" ,
679680 headers = [("Accept-Encoding" , "gzip" ), ("If-None-Match" , etag_header )],
680681 )
681- # This is the new behaviour we would expect after evaluating
682+ # This is the behaviour we would expect after evaluating
682683 # flask make_conditional at after_request
683684 self .assertEqual (r2 .status_code , 304 )
684685 self .assertEqual (r2 .headers .get ("ETag" ), etag_header )
@@ -688,7 +689,6 @@ def test_conditional_get_uses_strong_compressed_representation_evaluate_conditio
688689 def test_conditional_get_uses_weak_compressed_representation_evaluate_conditional (
689690 self ,
690691 ):
691- self .app .config ["COMPRESS_EVALUATE_CONDITIONAL_REQUEST" ] = True
692692 client = self .app .test_client ()
693693 r1 = client .get (
694694 "/weak-compress-conditional/" , headers = [("Accept-Encoding" , "gzip" )]
@@ -699,7 +699,7 @@ def test_conditional_get_uses_weak_compressed_representation_evaluate_conditiona
699699 "/weak-compress-conditional/" ,
700700 headers = [("Accept-Encoding" , "gzip" ), ("If-None-Match" , etag_header )],
701701 )
702- # This is the new behaviour we would expect after evaluating
702+ # This is the behaviour we would expect after evaluating
703703 # flask make_conditional at after_request
704704 self .assertEqual (r2 .status_code , 304 )
705705 self .assertEqual (r2 .headers .get ("ETag" ), etag_header )
0 commit comments