aboutsummaryrefslogtreecommitdiffstats
path: root/prh-app-server/src/main/java/org/onap
diff options
context:
space:
mode:
authorgrabinsk <maciej.grabinski@nokia.com>2019-06-07 12:21:44 +0200
committergrabinsk <maciej.grabinski@nokia.com>2019-06-10 11:15:06 +0200
commitb1d2017031a5ed827d1420442212e6aaa59bf662 (patch)
tree2095e0a5a819c8449532250215bd59f3acd0fd2b /prh-app-server/src/main/java/org/onap
parent574a2a8e300195f1693b025cc71281934ea677f3 (diff)
handle 404 from aai
(parsing response body from aai should not be attempted if there is no 2xx response) Change-Id: Iedc9daa65895600d826ac808784b3c6803a6dab4 Issue-ID: DCAEGEN2-1601 Signed-off-by: grabinsk <maciej.grabinski@nokia.com>
Diffstat (limited to 'prh-app-server/src/main/java/org/onap')
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AaiHttpClientConfig.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AaiHttpClientConfig.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AaiHttpClientConfig.java
index 8548ffe8..e09322d3 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AaiHttpClientConfig.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AaiHttpClientConfig.java
@@ -55,16 +55,22 @@ public class AaiHttpClientConfig {
public AaiHttpClient<AaiServiceInstanceQueryModel, AaiServiceInstanceResultModel> getServiceInstanceClient() {
return createLazyConfigClient(
(config, client) -> new AaiGetServiceInstanceClient(config, client)
- .map(httpResponse -> httpResponse.bodyAsJson(StandardCharsets.UTF_8,
- PrhModelAwareGsonBuilder.createGson(), AaiServiceInstanceResultModel.class)));
+ .map(httpResponse -> {
+ httpResponse.throwIfUnsuccessful();
+ return httpResponse.bodyAsJson(StandardCharsets.UTF_8,
+ PrhModelAwareGsonBuilder.createGson(), AaiServiceInstanceResultModel.class);
+ }));
}
@Bean
public AaiHttpClient<AaiModel, AaiPnfResultModel> getGetClient() {
return createLazyConfigClient(
(config, client) -> new AaiHttpGetClient(config, client)
- .map(httpResponse -> httpResponse.bodyAsJson(StandardCharsets.UTF_8,
- PrhModelAwareGsonBuilder.createGson(), AaiPnfResultModel.class)));
+ .map(httpResponse -> {
+ httpResponse.throwIfUnsuccessful();
+ return httpResponse.bodyAsJson(StandardCharsets.UTF_8,
+ PrhModelAwareGsonBuilder.createGson(), AaiPnfResultModel.class);
+ }));
}
private <T, U> AaiHttpClient<T, U> createLazyConfigClient(