mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-02-17 16:17:45 +01:00
17 lines
408 B
Rust
17 lines
408 B
Rust
use encoding_rs::SHIFT_JIS;
|
|
use tokio::fs;
|
|
use yaak_models::models::HttpResponse;
|
|
|
|
pub async fn read_response_body<'a>(
|
|
response: HttpResponse,
|
|
) -> Option<String> {
|
|
let body_path = match response.body_path {
|
|
None => return None,
|
|
Some(p) => p,
|
|
};
|
|
|
|
let body = fs::read(body_path).await.unwrap();
|
|
let (s, _, _) = SHIFT_JIS.decode(body.as_slice());
|
|
Some(s.to_string())
|
|
}
|