From fb9fe9aaa76de82356d1e1570d140b1ece0ac56e Mon Sep 17 00:00:00 2001 From: Marnanel Thurman Date: Mon, 6 Nov 2023 01:26:15 +0000 Subject: [PATCH] fix 404 to the modern system --- kepi/fastcgi.py | 13 ++++--------- test/test_fastcgi.py | 1 - 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/kepi/fastcgi.py b/kepi/fastcgi.py index 0a3f258..1615017 100644 --- a/kepi/fastcgi.py +++ b/kepi/fastcgi.py @@ -28,12 +28,6 @@ NODEINFO_PART_2_URI = '/nodeinfo.json' WEBFINGER_URI = '/.well-known/webfinger' WEBFINGER_MIMETYPE = 'application/jrd+json; charset=utf-8' -ERROR_404 = """Content-Type: text/html -Status: 404 Not found - -That resource does not exist here. -""" - DEFAULT_HOST = 'localhost' DEFAULT_PORT = 17177 @@ -77,7 +71,6 @@ Status: 200 OK Hello world. """ - return result def despatch_host_meta(env, match): @@ -86,7 +79,7 @@ def despatch_host_meta(env, match): result = { 'mimetype': CONTENTTYPE_HOST_META, - 'text': """ + 'text': f""" @@ -313,7 +306,9 @@ def despatch(env): result = format_message_for_http(**result) return result - return ERROR_404 + return format_message_for_http( + status = 404, + ) class KepiHandler(FcgiHandler): diff --git a/test/test_fastcgi.py b/test/test_fastcgi.py index 8acc356..cea64b9 100644 --- a/test/test_fastcgi.py +++ b/test/test_fastcgi.py @@ -38,7 +38,6 @@ def test_fastcgi_simple(): }, ) assert found['Status'].startswith('404 ') - assert found['Content-Type']==HTML_MIMETYPE def test_fastcgi_host_meta():