【Rust】reqwest Postのレスポンス(body payload)を表示する

“{:?}”, resp だとstatusだが、resp.text().await.unwrap()とすると、bodyを表示できる。

    let mut post_url = format!("http://192.168.33.10:3000/health");
    let client = reqwest::Client::new();
    let resp = client.post(post_url)
        .header(reqwest::header::CONTENT_TYPE, "application/json")
        .json(&str)
        .send()
        .await
        .unwrap();
    println!("{:?}", resp);
    println!("{}", resp.text().await.unwrap());

Finished `dev` profile [unoptimized + debuginfo] target(s) in 7.43s
Running `target/debug/axum`
Response { url: Url { scheme: “http”, cannot_be_a_base: false, username: “”, password: None, host: Some(Ipv4(192.168.33.10)), port: Some(3000), path: “/health”, query: None, fragment: None }, status: 200, headers: {“content-type”: “text/plain; charset=utf-8”, “content-length”: “8”, “date”: “Thu, 13 Mar 2025 13:44:24 GMT”} }
All good