Handle JSON request to /p/create

The Pillar Python SDK posts JSON, so we should handle that too.
This commit is contained in:
Sybren A. Stüvel 2016-05-09 11:16:20 +02:00
parent 8bb98aa280
commit 042b744b6e

View File

@ -225,6 +225,9 @@ def _create_new_project(project_name, user_id, overrides):
def create_project(overrides=None): def create_project(overrides=None):
"""Creates a new project.""" """Creates a new project."""
if request.mimetype == 'application/json':
project_name = request.json['name']
else:
project_name = request.form['project_name'] project_name = request.form['project_name']
user_id = g.current_user['user_id'] user_id = g.current_user['user_id']