Discussion
Loading...

Post

  • About
  • Code of conduct
  • Privacy
  • Users
  • Instances
  • About Bonfire
PuercoPop
PuercoPop
@PuercoPop@mastodon.social  ·  activity timestamp 2 days ago

When debugging an #axum handler in the context of a failing test. Is there a quick way to print the body of the response? The following is a mouthful

```rust
let err = String::from_utf8(
axum::body::to_bytes(res.into_body(), usize::MAX).await.unwrap().to_vec(),
);
println!("==> body {:?}", err);
```

#rust #rustlang

  • Copy link
  • Flag this post
  • Block

Kakapo Social

Kakapo Social: About · Code of conduct · Privacy · Users · Instances
Bonfire social · 1.0.1-alpha.23 no JS en
Automatic federation enabled
Log in
  • Explore
  • About
  • Members
  • Code of Conduct
Home
Login