File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed
Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -340,7 +340,10 @@ class Client:
340340 # Key can be explicitly file basename - value applied to just that file
341341 # takes precedence over mime type.
342342 # Key can be mime type - all files of that mimetype will get the value
343- Cache_Control = {}
343+ Cache_Control = {
344+ 'application/javascript' : "public, max-age=1209600" , # 2 weeks
345+ 'text/css' : "public, max-age=4838400" , # 8 weeks/2 months
346+ }
344347
345348 # list of valid http compression (Content-Encoding) algorithms
346349 # we have available
Original file line number Diff line number Diff line change @@ -868,3 +868,33 @@ def test_compression_zstd(self):
868868 self .assertDictEqual ({ key : value for (key , value ) in
869869 f .headers .items () if key in expected },
870870 expected )
871+
872+ def test_cache_control_css (self ):
873+ f = requests .get (self .url_base () + '/@@file/style.css' ,
874+ headers = {'content-type' : "" ,
875+ 'Accept' : '*/*' })
876+ print (f .status_code )
877+ print (f .headers )
878+
879+ self .assertEqual (f .status_code , 200 )
880+ self .assertEqual (f .headers ['Cache-Control' ], 'public, max-age=4838400' )
881+
882+ f = requests .get (self .url_base () + '/@@file/style.css' ,
883+ headers = {'content-type' : "" ,
884+ 'Accept' : '*/*' })
885+ print (f .status_code )
886+ print (f .headers )
887+
888+ self .assertEqual (f .status_code , 200 )
889+ self .assertEqual (f .headers ['Cache-Control' ], 'public, max-age=4838400' )
890+
891+ def test_cache_control_js (self ):
892+ f = requests .get (self .url_base () + '/@@file/help_controls.js' ,
893+ headers = {'content-type' : "" ,
894+ 'Accept' : '*/*' })
895+ print (f .status_code )
896+ print (f .headers )
897+
898+ self .assertEqual (f .status_code , 200 )
899+ self .assertEqual (f .headers ['Cache-Control' ], 'public, max-age=1209600' )
900+
You can’t perform that action at this time.
0 commit comments