Tests: Fix mockwebserver to parse incoming http bodies as UTF8
By not specifying a charset this used the system charset and
led to breaking tests under windows.
relates elastic/x-pack-elasticsearch#3498
Original commit: elastic/x-pack-elasticsearch@696e2061cb99b6c7c2dd4e2a3b6a6ee41150acb6
@@ -179,7 +179,7 @@ public class MockWebServer implements Closeable {
private MockRequest createRequest(HttpExchange exchange) throws IOException {
MockRequest request = new MockRequest(exchange.getRequestMethod(), exchange.getRequestURI(), exchange.getRequestHeaders());
if (exchange.getRequestBody() != null) {
- String body = Streams.copyToString(new InputStreamReader(exchange.getRequestBody()));
+ String body = Streams.copyToString(new InputStreamReader(exchange.getRequestBody(), StandardCharsets.UTF_8));
if (Strings.isEmpty(body) == false) {
request.setBody(body);
}
