You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2007/10/17 15:00:57 UTC

svn commit: r585474 - /jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java

Author: sebb
Date: Wed Oct 17 06:00:56 2007
New Revision: 585474

URL: http://svn.apache.org/viewvc?rev=585474&view=rev
Log:
Ensure that content type is set up (otherwise get NPE in testing)
TODO: is it the correct default? [Or should null C-T be allowed?]

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

Modified: jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java?rev=585474&r1=585473&r2=585474&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java (original)
+++ jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java Wed Oct 17 06:00:56 2007
@@ -376,8 +376,14 @@
                     // Allow the mimetype of the file to control the content type
                     // This is not obvious in GUI if you are not uploading any files,
                     // but just sending the content of nameless parameters
-                    if(!hasContentTypeHeader && getMimetype() != null && getMimetype().length() > 0) {
-                        post.setRequestHeader(HEADER_CONTENT_TYPE, getMimetype());
+                    if(!hasContentTypeHeader) {
+                        if(getMimetype() != null && getMimetype().length() > 0) {
+                            post.setRequestHeader(HEADER_CONTENT_TYPE, getMimetype());
+                        }
+                        else {
+                        	 // TODO - is this the correct default?
+                            post.setRequestHeader(HEADER_CONTENT_TYPE, APPLICATION_X_WWW_FORM_URLENCODED);
+                        }
                     }
                     
                     // Just append all the non-empty parameter values, and use that as the post body



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org