make it easy to get the response string
prabirshrestha opened this issue · comments
Seems like take_request_body_string
internally uses block on but not take_response_body_string
.
#[test]
fn test_html_output() {
trillium_testing::block_on(async {
let html = get("/")
.on(&handler)
.take_response_body_string()
.await
.unwrap();
assert_eq!(&html, "some html content");
});
}
I need to get html output and use selector to verify the response output using https://crates.io/crates/nipper. Is it possible to make it easy to get the response body so it is simple as the request body? I would expect the above code to be simple as below.
let mut conn = TestConn::build("post", "/", "some body")
.with_request_body("once told me");
assert_eq!(conn.take_request_body_string(), "once told me");
closed with trillium-testing@v0.4.0