diff --git a/src/views/scoreboard.py b/src/views/scoreboard.py index a687f96..9e6f622 100644 --- a/src/views/scoreboard.py +++ b/src/views/scoreboard.py @@ -23,7 +23,7 @@ import flask scoreboard = flask.Blueprint('scoreboard', __name__, template_folder='templates') -@scoreboard.route("/upload", methods=['POST']) +@scoreboard.route("/upload", methods=['POST', 'GET']) def upload(): """ This is the upload view. It accepts JSON only. @@ -33,6 +33,9 @@ def upload(): status code, success true if the data was received successfully and false otherwise and an error string. """ + if flask.request.method == 'GET': + flask.abort(404) + content = flask.request.get_json() try: diff --git a/test/test_scoreboard.py b/test/test_scoreboard.py index 931f2a7..85d0bb3 100644 --- a/test/test_scoreboard.py +++ b/test/test_scoreboard.py @@ -63,3 +63,7 @@ class ScoreboardTestCase(unittest.TestCase): self.assertTrue("true" in response.get_data(as_text=True)) self.assertEqual(response.status_code, 200) + + def test_get_upload(self): + response = self.client.get('/upload') + self.assertEqual(response.status_code, 404)