spacegate_kernel/utils/dump.rs
1use crate::{BoxResult, SgRequest};
2
3/// Dump the request body.
4/// # Errors
5/// 1. Fail to dump the body.
6pub async fn dump(req: SgRequest) -> BoxResult<SgRequest> {
7 if req.body().is_dumped() {
8 Ok(req)
9 } else {
10 let (parts, body) = req.into_parts();
11 let body = body.dump().await?;
12 Ok(SgRequest::from_parts(parts, body))
13 }
14}