diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/api/rest/httputils/HTTPCall.java b/src/main/java/org/gcube/informationsystem/resourceregistry/api/rest/httputils/HTTPCall.java index 6152e42..42ac9a7 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/api/rest/httputils/HTTPCall.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/api/rest/httputils/HTTPCall.java @@ -24,6 +24,8 @@ public class HTTPCall { private static final Logger logger = LoggerFactory .getLogger(HTTPCall.class); + + public static final String APPLICATION_JSON_CHARSET_UTF_8 = "application/json;charset=UTF-8"; public enum HTTPMETHOD { GET, POST, PUT, DELETE; @@ -138,14 +140,14 @@ public class HTTPCall { connection.setDoOutput(true); - connection.setRequestProperty("Content-type", "application/json"); + connection.setRequestProperty("Content-type", APPLICATION_JSON_CHARSET_UTF_8); connection.setRequestProperty("User-Agent", userAgent); connection.setRequestMethod(method.toString()); - - + if (body != null && (method == HTTPMETHOD.POST || method == HTTPMETHOD.PUT)) { + DataOutputStream wr = new DataOutputStream( connection.getOutputStream()); wr.writeBytes(body);