Add MediaType for fixing bug.
@@ -7,10 +7,7 @@ import greencity.constant.RestTemplateLinks;
import greencity.dto.PageableAdvancedDto;
import greencity.dto.achievement.UserVOAchievement;
import greencity.dto.place.PlaceVO;
-import greencity.dto.user.UserManagementDto;
-import greencity.dto.user.UserManagementVO;
-import greencity.dto.user.UserManagementViewDto;
-import greencity.dto.user.UserVO;
+import greencity.dto.user.*;
import greencity.enums.EmailNotification;
import greencity.message.AddEcoNewsMessage;
import greencity.message.SendChangePlaceStatusEmailMessage;
@@ -33,10 +30,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.ResponseEntity;
+import org.springframework.http.*;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder;
@@ -377,7 +371,9 @@ public class RestClient {
* @author Taras Kavkalo
*/
public void addEcoNews(AddEcoNewsMessage addEcoNewsMessage) {
- HttpEntity<AddEcoNewsMessage> entity = new HttpEntity<>(addEcoNewsMessage, new HttpHeaders());
+ HttpHeaders headers = new HttpHeaders();
+ headers.setContentType(MediaType.APPLICATION_JSON);
+ HttpEntity<AddEcoNewsMessage> entity = new HttpEntity<>(addEcoNewsMessage, headers);
restTemplate.exchange(greenCityUserServerAddress
+ RestTemplateLinks.ADD_ECO_NEWS, HttpMethod.POST, entity, Object.class)
.getBody();
