Adding a get method for /upload
This commit is contained in:
parent
bab32e271f
commit
41218817fb
2 changed files with 8 additions and 1 deletions
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue