本文整理汇总了Java中io.restassured.specification.RequestSpecification.body方法的典型用法代码示例。如果您正苦于以下问题:Java RequestSpecification.body方法的具体用法?Java RequestSpecification.body怎么用?Java RequestSpecification.body使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.restassured.specification.RequestSpecification
的用法示例。
在下文中一共展示了RequestSpecification.body方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: to
import io.restassured.specification.RequestSpecification; //导入方法依赖的package包/类
@When("^I send an empty body to ([\\w-]+)(/[\\w-]+)$")
public void I_send_an_empty_body_to_service_api(String serviceName, String api) {
RequestSpecification request = request(serviceName);
request.header("Content-Type", "application/json");
request.header("token", "ZVtrRXcpTnYWpsjnIpS3olQFGek84E5Z");
request.body(new byte[0]);
Response response = request.post(api);
statusCode = response.getStatusCode();
}
示例2: id
import io.restassured.specification.RequestSpecification; //导入方法依赖的package包/类
@When("^I send lead with id (\\d+) to ([\\w-]+)(/[\\w-/]+)$")
public void I_send_lead_with_id_to_service_api(int leadId, String serviceName, String api) {
RequestSpecification request = request(serviceName);
request.header("Content-Type", "application/json");
request.header("token", "ZVtrRXcpTnYWpsjnIpS3olQFGek84E5Z");
request.body(Leads.getLead(leadId).toString());
Response response = request.post(api);
statusCode = response.getStatusCode();
}
示例3: execute
import io.restassured.specification.RequestSpecification; //导入方法依赖的package包/类
public ValidatableResponse execute() {
RequestSpecification request = given();
if (contentType != null) {
request.contentType(contentType);
}
if (headers != null) {
request.headers(headers);
}
if (cookie != null) {
request.cookie(cookie);
}
if (body != null) {
request.body(body);
}
String requestStr = createRequestLog();
ValidatableResponse response = request
.urlEncodingEnabled(false)
.request(method, url)
.then();
String responseStr = createResponseLog(response);
appendToFile(requestStr, responseStr);
return response;
}
示例4: beforeRequest
import io.restassured.specification.RequestSpecification; //导入方法依赖的package包/类
@Override
public void beforeRequest(RequestSpecification requestSpecification) {
String requestBody = this.requestFacade.getRequestBody();
if (requestBody != null) {
String processed = templatingEngine.processBody(requestBody);
requestSpecification.body(processed);
}
}
示例5: beforeRequest
import io.restassured.specification.RequestSpecification; //导入方法依赖的package包/类
@Override
public void beforeRequest(RequestSpecification requestSpecification) {
GraphQLRequest graphQLRequest = requestFacade.getGraphQLRequest();
if (!Strings.isNullOrEmpty(graphQLRequest.getQuery())) {
graphQLRequest.setQuery(templatingEngine.processBody(graphQLRequest.getQuery()));
}
if (!Strings.isNullOrEmpty(graphQLRequest.getVariables())) {
graphQLRequest.setVariables(templatingEngine.processBody(graphQLRequest.getVariables()));
}
requestSpecification.body(graphQLRequest);
}