Replies: 1 comment 1 reply
-
async fn test(res: actix_web::dev::ServiceResponse) {
let bytes = actix_http::body::to_bytes(res.into_body()).await.unwrap();
assert!(std::str::from_utf8(&bytes).unwrap().contains("html"));
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi! I'm upgrading my actix-web graph database server to
4.0.0-beta.12
, and I noticed that theAnyBody
type has been introduced. This changes the previous API for accessing the body from a response in tests.This is what I used to do:
But that no longer works, I now need to do something like:
Maybe I'm missing something, but getting the string representation of a response body shouldn't be this difficult, right?
Beta Was this translation helpful? Give feedback.
All reactions