Test: fix build failure where randomly a restricted header was used.

Original commit: elastic/x-pack-elasticsearch@c3892181ab
This commit is contained in:
Martijn van Groningen 2015-05-18 12:41:00 +02:00
parent b11f457fb7
commit 1db5d1e37d

View File

@ -83,7 +83,9 @@ public class HttpClientTest extends ElasticsearchTestCase {
String paramValue = randomAsciiOfLength(3);
requestBuilder.setParam(paramKey, paramValue);
String headerKey = randomAsciiOfLength(3);
// Certain headers keys like via and host are illegal and the jdk http client ignores those, so lets
// prepend all keys with `_`, so we don't run into a failure because randomly a restricted header was used:
String headerKey = "_" + randomAsciiOfLength(3);
String headerValue = randomAsciiOfLength(3);
requestBuilder.setHeader(headerKey, headerValue);