Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ErrorContractSerializerHelper returns serialized string when bodyToSerialize is already a string #107

Closed
nmyers322 opened this issue Jul 17, 2018 · 2 comments · Fixed by #108

Comments

@nmyers322
Copy link
Contributor

nmyers322 commented Jul 17, 2018

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.

nmyers322 added a commit to nmyers322/riposte that referenced this issue Aug 2, 2018
nmyers322 added a commit to nmyers322/riposte that referenced this issue Aug 2, 2018
nmyers322 added a commit to nmyers322/riposte that referenced this issue Aug 2, 2018
nmyers322 added a commit to nmyers322/riposte that referenced this issue Aug 2, 2018
@nicmunroe
Copy link
Member

Fixed in #108 - thanks @nmyers322 ! This will go out with the next release.

@nicmunroe
Copy link
Member

Released in version 0.13.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants