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 #632pull/24376/head
parent
3ccb36a9ca
commit
f98a33bbe9
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue