Skip to content
This repository was archived by the owner on Jun 22, 2025. It is now read-only.

Commit 7e5e7a1

Browse files
committed
Refactoring a bit.
1 parent 7b335bf commit 7e5e7a1

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

eel/__init__.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ def _eel():
174174
page = page.replace('/** _start_geometry **/',
175175
'_start_geometry: %s,' % _safe_json(start_geometry))
176176
btl.response.content_type = 'application/javascript'
177+
_set_response_headers(btl.response)
177178
return page
178179

179180

@@ -190,9 +191,7 @@ def _static(path):
190191
if response is None:
191192
response = btl.static_file(path, root=root_path)
192193

193-
# https://stackoverflow.com/a/24748094/280852
194-
if _start_args['disable_cache']:
195-
response.set_header('Cache-Control', 'no-store')
194+
_set_response_headers(response)
196195
return response
197196

198197

@@ -321,3 +320,8 @@ def _websocket_close(page):
321320
if len(_websockets) == 0:
322321
sys.exit()
323322

323+
324+
def _set_response_headers(response):
325+
if _start_args['disable_cache']:
326+
# https://stackoverflow.com/a/24748094/280852
327+
response.set_header('Cache-Control', 'no-store')

0 commit comments

Comments
 (0)