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