ErrorContractSerializerHelper returns serialized string when bodyToSerialize is already a string
nmyers322 opened this issue · comments
Inside ErrorContractSerializerHelper, line 43:
return objectMapper.writeValueAsString(errorResponseBody.bodyToSerialize());
I've encountered a situation where I want to return HTML as a string. However, this line will accept bodyToSerialize and will attempt to serialize the HTML as a string, which results in the HTML being wrapped in quotes and all line breaks and quotes are then escaped. For example,
<html>
<body property="value">
</html>
would become
"<html>\n <body property=\"value\">\n</html>"
Solution: include another conditional. If errorResponseBody is already a string, do not re-serialize it.
Fixed in #108 - thanks @nmyers322 ! This will go out with the next release.
Released in version 0.13.1
.