Author: sebb
Date: Thu Apr 21 01:48:21 2011
New Revision: 1095590

URL: http://svn.apache.org/viewvc?rev=1095590&view=rev
Log:
Ensure content-type is always set

Modified:
    
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java

Modified: 
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java?rev=1095590&r1=1095589&r2=1095590&view=diff
==============================================================================
--- 
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
 (original)
+++ 
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
 Thu Apr 21 01:48:21 2011
@@ -266,16 +266,16 @@ public class HTTPHC4Impl extends HTTPHCA
             // Needs to be done after execute to pick up all the headers
             res.setRequestHeaders(getConnectionHeaders((HttpRequest) 
localContext.getAttribute(ExecutionContext.HTTP_REQUEST)));
 
+            Header contentType = 
httpResponse.getLastHeader(HEADER_CONTENT_TYPE);
+            if (contentType != null){
+                String ct = contentType.getValue();
+                res.setContentType(ct);
+                res.setEncodingAndType(ct);                    
+            }
             HttpEntity entity = httpResponse.getEntity();
             if (entity != null) {
                 InputStream instream = entity.getContent();
                 res.setResponseData(readResponse(res, instream, (int) 
entity.getContentLength()));
-                Header contentType = entity.getContentType();
-                if (contentType != null){
-                    String ct = contentType.getValue();
-                    res.setContentType(ct);
-                    res.setEncodingAndType(ct);                    
-                }
             }
             
             res.sampleEnd(); // Done with the sampling proper.



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@jakarta.apache.org
For additional commands, e-mail: notifications-h...@jakarta.apache.org

Reply via email to