templates.get.Java.handlebars Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of plyex Show documentation
Show all versions of plyex Show documentation
OpenAPI augmentation based on Ply autotests
The newest version!
HttpClient client = HttpClient.newHttpClient();
{{#if item}}
String {{item.name}} = "{{item.value}}";
{{/if}}
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(baseUrl{{#each chunks}} + {{#unless this.param}}"{{/unless}}{{this.path}}{{#unless this.param}}"{{/unless}}{{/each}}))
.setHeader("Accept", "application/json")
.setHeader("Authorization", "Bearer " + authToken)
.build();
HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() == HttpURLConnection.HTTP_OK) {
{{type}}{{#if array}}[]{{/if}} {{name}} = new Gson().fromJson(response.body(), {{type}}{{#if array}}[]{{/if}}.class);
{{#if item}}
assert {{name}}.get{{capitalize item.name}}().equals({{item.name}});
{{/if}}
System.out.println("{{name}}: " + response.body());
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy