简体   繁体   English

Rest 保证问题 io.restassured.internal.RestAssuredResponseImpl@46fc522d 响应

[英]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.在执行时,我收到 io.restassured.internal.RestAssuredResponseImpl@46fc522d,请查看代码并查看随附的 postman 请求参数。 Please note that its content-type is multipart/form-data请注意,它的内容类型是 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:有两种方法可以将响应 object 转换为用于记录或打印的字符串:

String print() : Print the response body and return it as string. String print() :打印响应正文并将其作为字符串返回。 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. String prettyPrint() :如果可能的话,漂亮地打印响应正文并将其作为字符串返回。 Mainly useful for debug purposes when writing tests.主要用于编写测试时的调试目的。 Pretty printing is possible for content-types JSON, XML and HTML.内容类型 JSON、XML 和 HTML 可以进行漂亮的打印。 Returns: The body as a string.返回: 作为字符串的正文。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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