From b1a2548c184d82ee24e6ff7d4f0a962f4100e9f3 Mon Sep 17 00:00:00 2001 From: Vijay Kumar S <94220135+vijay151096@users.noreply.github.com> Date: Thu, 28 Nov 2024 12:42:12 +0530 Subject: [PATCH] [INJIWEB-1106] : add charset header for downlaod vc Signed-off-by: Vijay Kumar S <94220135+vijay151096@users.noreply.github.com> --- .../mimoto/service/impl/DataShareServiceImpl.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/mosip/mimoto/service/impl/DataShareServiceImpl.java b/src/main/java/io/mosip/mimoto/service/impl/DataShareServiceImpl.java index 3674b387..0cbd1b09 100644 --- a/src/main/java/io/mosip/mimoto/service/impl/DataShareServiceImpl.java +++ b/src/main/java/io/mosip/mimoto/service/impl/DataShareServiceImpl.java @@ -22,6 +22,8 @@ import org.springframework.util.AntPathMatcher; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.PathMatcher; +import org.springframework.http.HttpMethod; +import org.springframework.web.client.RestTemplate; import java.net.URL; @@ -99,7 +101,13 @@ public VCCredentialResponse downloadCredentialFromDataShare(PresentationRequest ErrorConstants.RESOURCE_INVALID.getErrorCode(), ErrorConstants.RESOURCE_INVALID.getErrorMessage()); } - String vcCredentialResponseString = restApiClient.getApi(credentialsResourceUri, String.class); + RestTemplate restTemplate = new RestTemplate(); + HttpHeaders headers = new HttpHeaders(); + headers.add("Accept", "application/json"); + headers.add("Accept-Charset", "UTF-8"); + + HttpEntity entity = new HttpEntity<>(headers); + String vcCredentialResponseString = restTemplate.exchange(credentialsResourceUri, HttpMethod.GET, entity, String.class).getBody(); if (vcCredentialResponseString == null) { throw new InvalidCredentialResourceException( ErrorConstants.SERVER_UNAVAILABLE.getErrorCode(),