aboutsummaryrefslogtreecommitdiffstats
path: root/backend/routes/forms/new.py
diff options
context:
space:
mode:
authorGravatar ks129 <[email protected]>2020-12-10 14:52:55 +0200
committerGravatar GitHub <[email protected]>2020-12-10 14:52:55 +0200
commit362c665b42101762a6d55691a670ca17524a85e9 (patch)
treea7649a765812096a21a87b8089f5977517c80a43 /backend/routes/forms/new.py
parentAdd validation level for same ID forms (diff)
Make JSON errors more JS friendly and add response codes
Co-authored-by: Joe Banks <[email protected]>
Diffstat (limited to 'backend/routes/forms/new.py')
-rw-r--r--backend/routes/forms/new.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/backend/routes/forms/new.py b/backend/routes/forms/new.py
index 5a30a27..6437a4a 100644
--- a/backend/routes/forms/new.py
+++ b/backend/routes/forms/new.py
@@ -29,7 +29,7 @@ class FormCreate(Route):
if await request.state.db.forms.find_one({"_id": form.id}):
return JSONResponse({
"error": "Form with same ID already exists."
- })
+ }, status_code=400)
await request.state.db.forms.insert_one(form.dict(by_alias=True))
return JSONResponse(form.dict())