Let mock server write response in UTF-8

This commit is contained in:
Dominik Przybysz 2015-06-17 11:36:41 +02:00
parent dbfb3727af
commit 57a6e06ac0
3 changed files with 45 additions and 6 deletions

View file

@ -13,7 +13,7 @@ import org.apache.http.util.EntityUtils
class Util {
static GPathResult extractXmlResponse(CloseableHttpResponse response) {
HttpEntity entity = response.entity
GPathResult xml = new XmlSlurper().parseText(EntityUtils.toString(entity))
GPathResult xml = new XmlSlurper().parseText(EntityUtils.toString(entity, 'UTF-8'))
EntityUtils.consumeQuietly(entity)
return xml
}
@ -27,7 +27,7 @@ class Util {
static Object extractJsonResponse(CloseableHttpResponse response) {
HttpEntity entity = response.entity
Object json = new JsonSlurper().parseText(EntityUtils.toString(entity))
Object json = new JsonSlurper().parseText(EntityUtils.toString(entity, 'UTF-8'))
EntityUtils.consumeQuietly(entity)
return json
}