aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormark.j.leonard <mark.j.leonard@gmail.com>2018-09-19 18:57:46 +0100
committermark.j.leonard <mark.j.leonard@gmail.com>2018-09-19 19:13:51 +0100
commitd6f71a1ecc6f7f758f516b226af5b128b2a0d9e1 (patch)
tree86c59ba424f7c7ab4b9ac573bfd840ae77427638
parentf98e76c39e2ba70abb573cea50cc78ef54c90105 (diff)
Specify Content-Type in all HTTP requests
Explicitly specify all HTTP payload content as JSON, for compatibility with Elasticsearch 6.x Change-Id: Ibd6ad7bfd627a5c1bdfb04a950472e4cedfd790d Issue-ID: AAI-1650 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
-rw-r--r--src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchHttpController.java7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchHttpController.java b/src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchHttpController.java
index 841f477..a93274e 100644
--- a/src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchHttpController.java
+++ b/src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchHttpController.java
@@ -342,7 +342,6 @@ public class ElasticSearchHttpController implements DocumentStoreInterface {
try {
conn.setRequestMethod("PUT");
- conn.setRequestProperty("Content-Type", "application/json");
} catch (ProtocolException e) {
shutdownConnection(conn);
throw new DocumentStoreOperationException("Failed to set HTTP request method to PUT.", e);
@@ -405,7 +404,6 @@ public class ElasticSearchHttpController implements DocumentStoreInterface {
try {
conn.setRequestMethod("PUT");
- conn.setRequestProperty("Content-Type", "application/json");
} catch (ProtocolException e) {
shutdownConnection(conn);
throw new DocumentStoreOperationException("Failed to set HTTP request method to PUT.", e);
@@ -553,7 +551,6 @@ public class ElasticSearchHttpController implements DocumentStoreInterface {
private void attachDocument(HttpURLConnection conn, DocumentStoreDataEntity doc)
throws DocumentStoreOperationException {
- conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestProperty("Connection", "Close");
attachContent(conn, doc.getContentInJson());
}
@@ -640,7 +637,6 @@ public class ElasticSearchHttpController implements DocumentStoreInterface {
try {
conn.setRequestMethod("PUT");
- conn.setRequestProperty("Content-Type", "application/json");
} catch (ProtocolException e) {
shutdownConnection(conn);
throw new DocumentStoreOperationException("Failed to set HTTP request method to PUT.", e);
@@ -805,7 +801,6 @@ public class ElasticSearchHttpController implements DocumentStoreInterface {
try {
conn.setRequestMethod("POST");
- conn.setRequestProperty("Content-Type", "application/json");
} catch (ProtocolException e) {
shutdownConnection(conn);
throw new DocumentStoreOperationException("Failed to set HTTP request method to POST.", e);
@@ -854,7 +849,6 @@ public class ElasticSearchHttpController implements DocumentStoreInterface {
try {
conn.setRequestMethod("POST");
- conn.setRequestProperty("Content-Type", "application/json");
} catch (ProtocolException e) {
shutdownConnection(conn);
throw new DocumentStoreOperationException("Failed to set HTTP request method to POST.", e);
@@ -913,6 +907,7 @@ public class ElasticSearchHttpController implements DocumentStoreInterface {
try {
conn = (HttpURLConnection) url.openConnection();
+ conn.setRequestProperty("Content-Type", "application/json");
conn.setDoOutput(true);
} catch (IOException e) {
shutdownConnection(conn);