Ensure that JSON is written to response body

Issue: SPR-15988
This commit is contained in:
Andreas Ahlenstorf
2017-09-21 12:19:35 +02:00
parent 15c82afc1c
commit b30f6fd991
2 changed files with 55 additions and 2 deletions

View File

@@ -356,7 +356,9 @@ public class ProtobufHttpMessageConverter extends AbstractHttpMessageConverter<M
throws IOException {
if (contentType.isCompatibleWith(APPLICATION_JSON)) {
this.printer.appendTo(message, new OutputStreamWriter(output, charset));
OutputStreamWriter writer = new OutputStreamWriter(output, charset);
this.printer.appendTo(message, writer);
writer.flush();
}
else {
throw new IOException("protobuf-java-util does not support " + contentType + " format");