use of io.swagger.io.HttpClient in project swagger-parser by swagger-api.
the class SimpleSwaggerReader method read.
@Override
public JsonNode read(final String url, final Authentication authentication, MessageBuilder messageBuilder) {
HttpClient httpClient = new io.swagger.io.HttpClient(url);
JsonNode jsonNode = null;
authentication.apply(httpClient);
try {
InputStream swaggerJson = httpClient.execute();
jsonNode = objectMapper.readTree(swaggerJson);
} catch (URISyntaxException | IOException e) {
messageBuilder.append(new Message("", e.getMessage(), Severity.ERROR));
}
httpClient.close();
return jsonNode;
}
Aggregations