From c84283411ffad8531cbdb1f45d3e2b38b088f848 Mon Sep 17 00:00:00 2001 From: "Plummer, Brittany" Date: Wed, 25 Sep 2019 18:04:11 -0400 Subject: mso should not send content type http header to Updated getHeaders to not add Content-Type header on GET requests Updated getHttpHeaders boolean to includeContentType Issue-ID: SO-2366 Signed-off-by: Benjamin, Max (mb388a) Change-Id: I476bf02791d699cda2ca4118c8f578c96461097e --- .../src/main/java/org/onap/so/client/sdnc/SDNCClient.java | 6 +++--- .../src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'bpmn/so-bpmn-tasks/src/main/java/org') diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java index 07f448e5e1..7d2fc10d0b 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java @@ -55,7 +55,7 @@ public class SDNCClient { BaseClient> STOClient = new BaseClient<>(); STOClient.setTargetUrl(targetUrl); - HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth()); + HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth(), true); STOClient.setHttpHeader(httpHeader); LinkedHashMap output = STOClient.post(jsonRequest, new ParameterizedTypeReference>() {}); @@ -67,7 +67,7 @@ public class SDNCClient { String jsonRequest = sdnCommonTasks.buildJsonRequest(request); BaseClient> STOClient = new BaseClient<>(); STOClient.setTargetUrl(url); - HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth()); + HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth(), true); STOClient.setHttpHeader(httpHeader); LinkedHashMap output = STOClient.post(jsonRequest, new ParameterizedTypeReference>() {}); @@ -87,7 +87,7 @@ public class SDNCClient { String targetUrl = UriBuilder.fromUri(properties.getHost()).path(queryLink).build().toString(); BaseClient> STOClient = new BaseClient<>(); STOClient.setTargetUrl(targetUrl); - HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth()); + HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth(), false); STOClient.setHttpHeader(httpHeader); LinkedHashMap output = STOClient.get(jsonRequest, new ParameterizedTypeReference>() {}); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java index 1144648517..e7e4e25af2 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java @@ -82,10 +82,12 @@ public class SdnCommonTasks { * @param auth * @return */ - public HttpHeaders getHttpHeaders(String auth) { + public HttpHeaders getHttpHeaders(String auth, boolean includeContentType) { HttpHeaders httpHeader = new HttpHeaders(); httpHeader.set("Authorization", auth); - httpHeader.setContentType(MediaType.APPLICATION_JSON); + if (includeContentType) { + httpHeader.setContentType(MediaType.APPLICATION_JSON); + } List acceptMediaTypes = new ArrayList<>(); acceptMediaTypes.add(MediaType.APPLICATION_JSON); httpHeader.setAccept(acceptMediaTypes); -- cgit 1.2.3-korg