fix: invalid API request body causes panic

Removes a stray unwrap() that was causing a request with invalid JSON / empty
body to panic the handler thread.

Fixes #632
pull/24376/head
Dom 2021-01-11 13:25:22 +00:00
parent 3ccb36a9ca
commit f98a33bbe9
1 changed files with 2 additions and 3 deletions

View File

@ -466,9 +466,8 @@ async fn create_database<M: ConnectionManager + Send + Sync + Debug + 'static>(
.clone();
let body = parse_body(req).await?;
let rules: DatabaseRules = serde_json::from_slice(body.as_ref())
.context(InvalidRequestBody)
.unwrap();
let rules: DatabaseRules = serde_json::from_slice(body.as_ref()).context(InvalidRequestBody)?;
server
.create_database(db_name, rules)
.await