mirror of
https://git.proxmox.com/git/proxmox
synced 2025-08-11 13:33:07 +00:00
formatting cleanup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
acbf549bf0
commit
68f4a68bc1
@ -199,20 +199,18 @@ async fn route_request(request: Request<Body>) -> Result<http::Response<Body>, E
|
|||||||
if let Some(ty) = parts.headers.get(http::header::CONTENT_TYPE) {
|
if let Some(ty) = parts.headers.get(http::header::CONTENT_TYPE) {
|
||||||
if ty.to_str()? == "application/json" {
|
if ty.to_str()? == "application/json" {
|
||||||
use futures::stream::TryStreamExt;
|
use futures::stream::TryStreamExt;
|
||||||
let json = serde_json::from_str(std::str::from_utf8(
|
let json =
|
||||||
body
|
serde_json::from_str(std::str::from_utf8(body.try_concat().await?.as_ref())?)?;
|
||||||
.try_concat()
|
|
||||||
.await?
|
|
||||||
.as_ref()
|
|
||||||
)?)?;
|
|
||||||
match json {
|
match json {
|
||||||
Value::Object(map) => for (k, v) in map {
|
Value::Object(map) => {
|
||||||
let existed = params
|
for (k, v) in map {
|
||||||
.get_or_insert_with(serde_json::Map::new)
|
let existed = params
|
||||||
.insert(k, v)
|
.get_or_insert_with(serde_json::Map::new)
|
||||||
.is_some();
|
.insert(k, v)
|
||||||
if existed {
|
.is_some();
|
||||||
bail!("tried to override path-based parameter!");
|
if existed {
|
||||||
|
bail!("tried to override path-based parameter!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => bail!("expected a json object"),
|
_ => bail!("expected a json object"),
|
||||||
|
Loading…
Reference in New Issue
Block a user