private static Map<String, String> randomHeadersFrom(Map<String, String> headers) { Map<String, String> newHeaders = new HashMap<>(); if (headers.isEmpty()) { return newHeaders; } int i = randomInt(headers.size() - 1); for (Map.Entry<String, String> entry : headers.entrySet()) { if (randomInt(i) == 0) { newHeaders.put(entry.getKey(), entry.getValue()); } } return newHeaders; }
private static void putContext(ActionRequest<?> request, Map<String, String> context) { for (Map.Entry<String, String> header : context.entrySet()) { request.putInContext(header.getKey(), header.getValue()); } }
private static void putHeaders(ActionRequest<?> request, Map<String, String> headers) { for (Map.Entry<String, String> header : headers.entrySet()) { request.putHeader(header.getKey(), header.getValue()); } }