diff options
| author | Tom Harley | 2021-07-09 15:16:54 +0000 |
|---|---|---|
| committer | Tom Harley | 2021-07-09 15:16:54 +0000 |
| commit | 57e7488149ee093e34774d83ffe161fb305a7dde (patch) | |
| tree | ed922a052cd8eb6fc5b77c21970cb0d0b02b9cb3 /sw/auth.py | |
| parent | Add testing for authorisation decorators (diff) | |
| download | swap-57e7488149ee093e34774d83ffe161fb305a7dde.tar.gz swap-57e7488149ee093e34774d83ffe161fb305a7dde.zip | |
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.
Diffstat (limited to 'sw/auth.py')
| -rw-r--r-- | sw/auth.py | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -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 |
