我有一个JSON
正文作为Java String
。我想将此String
转换为RestAssured Response
。这可能吗?
或者
是否可以将apache HttpResponse
转换为RestAssured Response
HttpClient httpClient = HttpClientBuilder.create().build();
HttpPost httpPost = new HttpPost(url);
org.apache.http.entity.StringEntity entity = new org.apache.http.entity.StringEntity(body);
httpPost.setEntity(entity);
httpPost.setHeader("Accept", "application/json");
httpPost.setHeader("Content-type", "application/json");
HttpResponse httpResponse = httpClient.execute(httpPost);
我想将httpResponse
转换为RestAssured Response
答案 0 :(得分:0)
Response
Javadoc说" REST保证请求的响应。"。所以,不,我不认为这是可能的。无论如何,我会以RestAssurred
提出请求,我觉得更容易。