简体   繁体   中英

Rest assured issue io.restassured.internal.RestAssuredResponseImpl@46fc522d in response

On Executing I am getting io.restassured.internal.RestAssuredResponseImpl@46fc522d, please review the code and also see the attached postman request parameters. Please note that its content-type is multipart/form-data

public  static Response uploadDocument(String url, String documentType, String firstName, String lastName, String nationality, String dateExpiry, String dateIssue, String dob, String fullName, String gender, String identityNo, String middleName, String files, String files2, String token, String cookie, String xsrfToken) {
    Response response = given()
                .header("Content-Type", "multipart/form-data")
            .config(config().multiPartConfig(multiPartConfig().defaultSubtype("mixed")))
            .header("cookie", cookie)
            .header("X-XSRF-TOKEN", xsrfToken)
    .formParam("documentType", documentType).
                    formParam("firstName", firstName).
                    formParam("lastName", lastName).
                    formParam("nationality", nationality).
                    formParam("dateExpiry", dateExpiry).
                    formParam("dateIssue", dateIssue).
                    formParam("dob", dob).
                    formParam("fullName", fullName).
                    formParam("middleName", middleName).
                    formParam("gender", gender).
                    formParam("identityNo", identityNo).
    multiPart("files",  new File(files),"application/png" ).
    multiPart("files", new File(files2),"application/png" ).
    auth().oauth2(token)
                .when().get(url)
                    .then().extract().response();
    return response;
}

Postmain 请求表单数据

I believe this has already been answered in the comments, but moving it into the answers section so there can be an accepted answer. There are two methods to transform the response object to a string for logging or printing:

String print() : Print the response body and return it as string. Mainly useful for debug purposes when writing tests. Returns: The body as a string.

String prettyPrint() : Pretty-print the response body if possible and return it as string. Mainly useful for debug purposes when writing tests. Pretty printing is possible for content-types JSON, XML and HTML. Returns: The body as a string.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM