Added charset=UTF-8 content-type declaration

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry-api@146344 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2017-03-24 17:22:53 +00:00
parent fc867428f0
commit 001146c7c2
1 changed files with 5 additions and 3 deletions

View File

@ -24,6 +24,8 @@ public class HTTPCall<C> {
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<C> {
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);