}
method.addRequestHeader(name, name);
}
HttpClientExecutionCollectionAspect aspectInstance = getAspect();
HttpObfuscator obfuscator = aspectInstance.getHttpHeadersObfuscator();
if (!defaultHeaders) {
for (String name : HttpObfuscator.DEFAULT_OBFUSCATED_HEADERS_LIST) {
if ("WWW-Authenticate".equalsIgnoreCase(name)) {
continue; // this is a response header
}
method.addRequestHeader(name, name);
}
obfuscator.incrementalUpdate(HttpObfuscator.OBFUSCATED_HEADERS_SETTING, StringUtil.implode(headerSet, ","));
}
int response = httpClient.executeMethod(method);
Operation op = assertExecutionResult(uri, method, response, false);
OperationMap reqDetails = op.get("request", OperationMap.class);
OperationList reqHeaders = reqDetails.get("headers", OperationList.class);
Map<String, String> requestHeaders = toHeadersMap(reqHeaders);
OperationMap rspDetails = op.get("response", OperationMap.class);
OperationList rspHeaders = rspDetails.get("headers", OperationList.class);
Map<String, String> responseHeaders = toHeadersMap(rspHeaders);
Map<String, String> hdrsMap = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
if (MapUtil.size(requestHeaders) > 0) {
hdrsMap.putAll(requestHeaders);
}
if (MapUtil.size(responseHeaders) > 0) {
hdrsMap.putAll(responseHeaders);
}
Collection<?> obscuredValues = (ObscuredValueSetMarker) obfuscator.getSensitiveValueMarker();
for (String name : headerSet) {
String value = hdrsMap.get(name);
assertNotNull("Missing value for header: " + name, value);
assertTrue("Unobscured value of " + name, obscuredValues.contains(value));
}