Unit test in Axum 0.5.16

I'm writing a unit test for a server being built with Axum, using the official example

  // the response
        let response = app
                    .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
                          "fullname":format!("{firstname} {middlename} {lastname}", ),

        println!("hey {:?}", response.body());

the response body returns an instance of UnsynBoxBody, I'm stuck trying to get the content from the UnsyncBoxBody instance. and my test keeps failing with a 500 error even thought the endpoint works fine.

If the endpoint is responding with a 500 status code, your problem isn't getting the data out of the body, you must be missing something in your request

I'll check that again

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.