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);
+ }
}
}
|