[英]Convert String (Json) to Rest Assured Response
我有一个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
Response
Javadoc说“ REST保证的请求的响应。”。 所以,不,我认为这不可能。 无论如何,我都会用RestAssurred
发出请求,我发现它更容易。
参考: http : //static.javadoc.io/com.jayway.restassured/rest-assured/1.2.3/com/jayway/restassured/response/Response.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.