| @@ -19,15 +19,18 @@ class PicoProtocol(websockets.WebSocketServerProtocol): | |||
| document = Path(__file__, '..', Path(path).name).resolve() | |||
| if not document.is_file(): | |||
| document = Path(__file__, '..', 'pico.html').resolve() | |||
| if document.suffix == '.html': | |||
| content_type = 'text/html; charset=utf-8' | |||
| elif path.endswith('.js'): | |||
| elif document.suffix == '.js': | |||
| content_type = 'application/javascript; charset=utf-8' | |||
| elif path.endswith('.css'): | |||
| elif document.suffix == '.css': | |||
| content_type = 'text/css; charset=utf-8' | |||
| elif path.endswith('.svg'): | |||
| elif document.suffix == '.svg': | |||
| content_type = 'image/svg+xml; charset=utf-8' | |||
| else: | |||
| content_type = 'text/plain; charset=utf-8' | |||
| return ( | |||
| http.HTTPStatus.OK, | |||
| [('Content-Type', content_type)], | |||