放心的请求主体数组对象

Array of object as request body in restassured

我通常能够创建 class 作为 .body() 的输入并且放心地正确读取所有数据,但不是数组。
我尝试将对象 class 声明为数组,但放心并没有像我想要的那样正确接受它。
使用 rest-assured 时,我可以将对象数组作为 .body 发送吗?

请求正文

[
    {
        "product_type" : "1",
        "request_by" : "android",
    },
    {
        "product_type" : "2",
        "request_by" : "ios",
    }
]

我做的class

public class ProdReq {
    private String product_type;
    private String request_by;

    public String getProduct_type() {
        return product_type;
    }

    public void setProduct_type(String product_type) {
        this.product_type = product_type;
    }

    public String getRequest_by() {
        return request_by;
    }

    public void setRequest_by(String request_by) {
        this.request_by = request_by;
    }

我用来获取响应的代码

ProdReq[] prodReq = new ProdReq[2]
//set the data
......
given().when().body(prodReq).post({{api_url}}).then().extract().response();

我是否应该创建 class 的 JSONObject(如果可能),然后将它们放入 JSONArray 中?

@GFB ContentType 设置了吗?尝试使用这样的东西:

List<ProdReq> prodReq = new ArrayList<>();
... set up the data. 

given().contentType(ContentType.JSON).when().body(prodReq).post({{api_url}}).then().extract().response();

我正在使用对象序列化到 JSON 主体,在我的项目中没有任何问题。