Skip to content

Commit 4acc377

Browse files
committed
DTSPB-4818 update ResponseDecorator
1 parent 2329f3e commit 4acc377

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/main/java/uk/gov/hmcts/probate/client/ResponseDecorator.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,9 @@ public String bodyToString() {
3737
}
3838

3939
public ErrorResponse mapToErrorResponse() {
40-
ObjectMapper mapper = new ObjectMapper();
4140
ErrorResponse errorResponse = null;
4241
try {
43-
errorResponse = mapper.readValue(this.bodyToString(), ErrorResponse.class);
42+
errorResponse = this.objectMapper.readValue(this.bodyToString(), ErrorResponse.class);
4443
} catch (IOException e) {
4544
log.debug("Response contained empty body");
4645
}

src/main/java/uk/gov/hmcts/probate/client/business/BusinessServiceConfiguration.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package uk.gov.hmcts.probate.client.business;
22

3+
import com.fasterxml.jackson.core.JsonGenerator;
34
import com.fasterxml.jackson.databind.DeserializationFeature;
45
import com.fasterxml.jackson.databind.ObjectMapper;
56
import com.fasterxml.jackson.databind.SerializationFeature;
@@ -20,6 +21,7 @@ Encoder feignEncoder() {
2021
ObjectMapper objectMapper = new ObjectMapper();
2122
objectMapper.enable(SerializationFeature.WRAP_ROOT_VALUE);
2223
objectMapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE);
24+
objectMapper.disable(JsonGenerator.Feature.AUTO_CLOSE_JSON_CONTENT);
2325
return new JacksonEncoder(objectMapper);
2426
}
2527

0 commit comments

Comments
 (0)