10 lines
339 B
Rust
10 lines
339 B
Rust
use serde_json::{self, Value};
|
|
use hyper::body::{to_bytes, Bytes};
|
|
use hyper::Body;
|
|
use std::u8;
|
|
|
|
pub async fn parse_params(body_raw: &mut Body) -> Result<Value, serde_json::error::Error> {
|
|
let bytes: &[u8] = &*to_bytes(body_raw).await.unwrap(); // rarely fails
|
|
let values: Value = serde_json::from_slice(bytes)?;
|
|
Ok(values)
|
|
} |