diff --git a/curl.py b/curl.py index 526f1f4..65693a5 100644 --- a/curl.py +++ b/curl.py @@ -123,4 +123,9 @@ def curl_response(request): if os.path.exists(f"templates/{path}.html"): return render_template(f"{path}.html") - return error_response(request) \ No newline at end of file + # Return curl error page + error = { + "code": 404, + "message": "The requested resource was not found on this server." + } + return render_template("error.ascii",header=get_header(),error=error), 404, {'Content-Type': 'text/plain; charset=utf-8'} \ No newline at end of file diff --git a/templates/error.ascii b/templates/error.ascii new file mode 100644 index 0000000..9ad28da --- /dev/null +++ b/templates/error.ascii @@ -0,0 +1,9 @@ +{{header}} +─────────────────────────────────────────────── + ERROR: {{ error.code }}  +──────────── + +{{ error.message }} + +If you believe this is an error, please contact me via my socials listed at /contact + diff --git a/tests/api.hurl b/tests/api.hurl index 0d16c63..e714456 100644 --- a/tests/api.hurl +++ b/tests/api.hurl @@ -6,10 +6,15 @@ GET http://127.0.0.1:5000/api/v1/ip HTTP 200 [Asserts] jsonpath "$.ip" == "127.0.0.1" + GET http://127.0.0.1:5000/api/v1/time HTTP 200 GET http://127.0.0.1:5000/api/v1/timezone HTTP 200 +[Asserts] +jsonpath "$.timezone" >= 10 +jsonpath "$.timezone" <= 12 + GET http://127.0.0.1:5000/api/v1/message HTTP 200 GET http://127.0.0.1:5000/api/v1/project @@ -17,4 +22,7 @@ HTTP 200 GET http://127.0.0.1:5000/api/v1/tools HTTP 200 [Asserts] -jsonpath "$.tools" count > 5 \ No newline at end of file +jsonpath "$.tools" count > 5 + +GET http://127.0.0.1:5000/api/v1/playing +HTTP 200 \ No newline at end of file