diff --git a/src/main/java/ru/sbtqa/tag/apifactory/rest/RestEntityImpl.java b/src/main/java/ru/sbtqa/tag/apifactory/rest/RestEntityImpl.java index b00dd23..2764d0f 100644 --- a/src/main/java/ru/sbtqa/tag/apifactory/rest/RestEntityImpl.java +++ b/src/main/java/ru/sbtqa/tag/apifactory/rest/RestEntityImpl.java @@ -73,7 +73,8 @@ public Bullet get(String url, Map headers) throws ApiRestExcepti } try { - bullet = new Bullet(headersResponse, EntityUtils.toString(response.getEntity())); + bullet = new Bullet(headersResponse, + EntityUtils.toString(response.getEntity(), Props.get("api.encoding"))); } catch (IOException | ParseException ex) { LOG.error("Error in response body get", ex); } @@ -100,6 +101,7 @@ public Bullet post(String url, Map headers, Object body) throws LOG.info("Headers are: {}", headers); List postParams = new ArrayList<>(); + String encoding = Props.get("api.encoding"); if (body instanceof Map) { Map params = (Map) body; @@ -112,7 +114,7 @@ public Bullet post(String url, Map headers, Object body) throws } LOG.info("Body (form-data) is: {}", body); } else if (body instanceof String) { - post.setEntity(new StringEntity((String) body, Props.get("api.encoding"))); + post.setEntity(new StringEntity((String) body, encoding)); } HttpResponse response = client.execute(post); @@ -132,7 +134,7 @@ public Bullet post(String url, Map headers, Object body) throws } } - return new Bullet(headersResponse, EntityUtils.toString(response.getEntity())); + return new Bullet(headersResponse, EntityUtils.toString(response.getEntity(), encoding)); } catch (IOException ex) { LOG.error("Failed to get response", ex); } finally {