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 --- .../onap/so/client/sdn/common/SdnCommonTasksTest.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'bpmn/so-bpmn-tasks/src/test/java/org/onap') diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java index 9c736b7634..a8816e1b04 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java @@ -21,6 +21,7 @@ package org.onap.so.client.sdn.common; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import java.util.LinkedHashMap; import org.junit.Assert; import org.junit.Rule; @@ -29,6 +30,8 @@ import org.junit.rules.ExpectedException; import org.onap.so.client.exception.BadResponseException; import org.onap.so.client.exception.MapperException; import org.onap.so.client.sdnc.SdnCommonTasks; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; public class SdnCommonTasksTest { @@ -53,7 +56,20 @@ public class SdnCommonTasksTest { @Test public void getHttpHeadersTest() { - Assert.assertNotNull(sdnCommonTasks.getHttpHeaders("")); + HttpHeaders result = sdnCommonTasks.getHttpHeaders("auth", true); + + assertEquals("auth", result.getFirst("Authorization")); + assertEquals(MediaType.APPLICATION_JSON.toString(), result.getFirst("Content-Type")); + assertEquals(MediaType.APPLICATION_JSON.toString(), result.getFirst("Accept")); + } + + @Test + public void getHttpHeadersGetRequestTest() { + HttpHeaders result = sdnCommonTasks.getHttpHeaders("auth", false); + + assertEquals("auth", result.getFirst("Authorization")); + assertEquals(MediaType.APPLICATION_JSON.toString(), result.getFirst("Accept")); + assertFalse(result.containsKey("Content-Type")); } @Test -- cgit 1.2.3-korg