Fix response header capture
MODIFY
instrumentation/apache-httpclient/apache-httpclient-2.0/src/main/java/io/opentelemetry/auto/instrumentation/apachehttpclient/v2_0/CommonsHttpClientDecorator.java
instrumentation/apache-httpclient/apache-httpclient-2.0/src/main/java/io/opentelemetry/auto/instrumentation/apachehttpclient/v2_0/CommonsHttpClientDecorator.java
@@ -55,16 +55,13 @@ public class CommonsHttpClientDecorator extends HttpClientDecorator<HttpMethod,
@Override
protected String requestHeader(HttpMethod httpMethod, String name) {
- return header(httpMethod, name);
+ final Header header = httpMethod.getRequestHeader(name);
+ return header != null ? header.getValue() : null;
}
@Override
protected String responseHeader(HttpMethod httpMethod, String name) {
- return header(httpMethod, name);
- }
-
- private static String header(HttpMethod httpMethod, String name) {
- final Header header = httpMethod.getRequestHeader(name);
+ final Header header = httpMethod.getResponseHeader(name);
return header != null ? header.getValue() : null;
}
}

Fix response header capture (#649)