(self)
| 34 | pass # Suppress logging |
| 35 | |
| 36 | def do_GET(self): |
| 37 | global hot_reload_enabled |
| 38 | |
| 39 | # Handle SSE endpoint for hot reload |
| 40 | if self.path == '/__hot_reload' and hot_reload_enabled: |
| 41 | self.handle_sse() |
| 42 | return |
| 43 | |
| 44 | path = self.translate_path(self.path) |
| 45 | |
| 46 | if os.path.isfile(path): |
| 47 | if path.endswith('.html') and hot_reload_enabled: |
| 48 | self.serve_html_with_reload(path) |
| 49 | else: |
| 50 | super().do_GET() |
| 51 | return |
| 52 | |
| 53 | # SPA fallback |
| 54 | self.path = '/index.html' |
| 55 | index_path = self.translate_path(self.path) |
| 56 | if os.path.isfile(index_path): |
| 57 | if hot_reload_enabled: |
| 58 | self.serve_html_with_reload(index_path) |
| 59 | else: |
| 60 | super().do_GET() |
| 61 | else: |
| 62 | self.send_error(404) |
| 63 | |
| 64 | def serve_html_with_reload(self, path): |
| 65 | """Inject hot reload script into HTML.""" |
nothing calls this directly
no test coverage detected