jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1828476 - /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PostWriter.java
Date Thu, 05 Apr 2018 20:31:01 GMT
Author: pmouawad
Date: Thu Apr  5 20:31:01 2018
New Revision: 1828476

URL: http://svn.apache.org/viewvc?rev=1828476&view=rev
Log:
[Bug 60190] Content-Type is added for POST unconditionally
Fix test failure in Java
Bugzilla Id: 60190

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

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PostWriter.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PostWriter.java?rev=1828476&r1=1828475&r2=1828476&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PostWriter.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PostWriter.java
Thu Apr  5 20:31:01 2018
@@ -284,7 +284,7 @@ public class PostWriter {
                 String postBody = null;
                 if(!sampler.getSendParameterValuesAsPostBody()) {
                     // Set the content type
-                    if(!hasContentTypeHeader) {
+                    if(!hasContentTypeHeader && HTTPAbstractImpl.ADD_CONTENT_TYPE_TO_POST_IF_MISSING)
{
                         connection.setRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE,
HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED);
                     }
 
@@ -302,8 +302,9 @@ public class PostWriter {
                             connection.setRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE,
file.getMimeType());
                         }
                         else {
-                            // TODO: is this the correct default?
-                            connection.setRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE,
HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED);
+                            if(HTTPAbstractImpl.ADD_CONTENT_TYPE_TO_POST_IF_MISSING) {
+                                connection.setRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE,
HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED);
+                            }
                         }
                     }
 



Mime
View raw message