Skip to content

Commit

Permalink
Merge pull request Netflix#63 from timmc/utf8-encode-response
Browse files Browse the repository at this point in the history
UTF-8 encode response body when converting to bytes
  • Loading branch information
kerumai committed Apr 22, 2015
2 parents dab12e3 + d8a53e8 commit 707fd07
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import org.junit.runner.RunWith
import org.mockito.Mockito
import org.mockito.runners.MockitoJUnitRunner

import java.nio.charset.Charset
import java.util.zip.GZIPInputStream
import javax.servlet.http.HttpServletResponse

Expand Down Expand Up @@ -77,7 +78,7 @@ class sendResponse extends ZuulFilter {
try {
if (RequestContext.currentContext.responseBody != null) {
String body = RequestContext.currentContext.responseBody
writeResponse(new ByteArrayInputStream(body.bytes), outStream)
writeResponse(new ByteArrayInputStream(body.getBytes(Charset.forName("UTF-8"))), outStream)
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import org.junit.runner.RunWith
import org.mockito.Mockito
import org.mockito.runners.MockitoJUnitRunner

import java.nio.charset.Charset
import java.util.zip.GZIPInputStream
import javax.servlet.http.HttpServletResponse

Expand Down Expand Up @@ -76,7 +77,7 @@ class SendResponseFilter extends ZuulFilter {
try {
if (RequestContext.currentContext.responseBody != null) {
String body = RequestContext.currentContext.responseBody
writeResponse(new ByteArrayInputStream(body.bytes), outStream)
writeResponse(new ByteArrayInputStream(body.getBytes(Charset.forName("UTF-8"))), outStream)
return;
}

Expand Down

0 comments on commit 707fd07

Please sign in to comment.