diff --git a/src/lib/headers.py b/src/lib/headers.py index cc79ac4..f3b5d8f 100644 --- a/src/lib/headers.py +++ b/src/lib/headers.py @@ -8,11 +8,11 @@ class Headers: def has(self, key: str) -> bool: return key in self.headers.keys() - def get(self, key: str) -> str | None: + def get(self, key: str) -> str: if self.has(key): return self.headers[key] - return None + return '' def add(self, key, value) -> None: self.headers[key] = value diff --git a/src/lib/router.py b/src/lib/router.py index 6c4f40b..09356f9 100644 --- a/src/lib/router.py +++ b/src/lib/router.py @@ -52,7 +52,7 @@ routes = [ lambda request, *_: Response( ResponseCode.OK, {'Content-Type': 'text/html'}, - (parse_file('./home.html', dict(prev='\\/')).encode('utf-8') if request.method == Method.GET else ( + ((parse_file('./home.html', dict(prev='\\/')).encode('utf-8') if not 'Nim httpclient' in request.headers.get('user-agent') else error_page(200)) if request.method == Method.GET else ( [ (lambda form_data: ( (lambda time: (