use of ru.sbtqa.tag.api.repository.ApiPair in project page-factory-2 by sbtqa.
the class EndpointEntry method send.
public void send() {
reflection.applyAnnotations(FromResponse.class);
reflection.applyAnnotations(Query.class);
reflection.applyAnnotations(Stashed.class);
reflection.applyAnnotations(Mutator.class);
String url = PathUtils.unite(host.isEmpty() ? PROPERTIES.getBaseURI() : PlaceholderUtils.replaceTemplatePlaceholders(host), path);
RequestSpecification request = buildRequest();
Response response;
switch(method) {
case GET:
response = request.get(url);
break;
case POST:
response = request.post(url);
break;
case PUT:
response = request.put(url);
break;
case PATCH:
response = request.patch(url);
break;
case DELETE:
response = request.delete(url);
break;
case OPTIONS:
response = request.options(url);
break;
case HEAD:
response = request.head(url);
break;
default:
throw new UnsupportedOperationException("Request method " + method + " is not supported");
}
ApiEnvironment.getRepository().add(this.getClass(), new ApiPair(request, response.then().log().all(true)));
}
Aggregations