From 57e7488149ee093e34774d83ffe161fb305a7dde Mon Sep 17 00:00:00 2001 From: Tom Harley Date: Fri, 9 Jul 2021 15:16:54 +0000 Subject: Add basic inbox/outbox functionality Lots of added TODOs, and very little test coverage for the new functions. Next step is to get 100% coverage of what we have so far. --- sw/auth.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'sw/auth.py') diff --git a/sw/auth.py b/sw/auth.py index 2f03a04..85212ec 100644 --- a/sw/auth.py +++ b/sw/auth.py @@ -35,10 +35,25 @@ def load_logged_in_user(): ) +def json_input(view): + @functools.wraps(view) + def wrapped_view(**kwargs): + if not request.is_json: + return "Request body is not JSON", 422 + + return view(**kwargs) + + return wrapped_view + + +def from_trusted_server(view): + # TODO + return view + + @bp.route("/register", methods=["POST"]) +@json_input def register(): - if not request.is_json: - return "Request body is not JSON", 422 data = request.json -- cgit v1.2.1