Author: pmouawad
Date: Mon Feb 22 21:02:45 2016
New Revision: 1731739

URL: http://svn.apache.org/viewvc?rev=1731739&view=rev
Log:
Bug 59044 - Http Sampler : It should not be possible to select the multipart 
encoding if the method is not POST
#resolve #138
https://github.com/apache/jmeter/pull/138
Patch by Benoit Wiart
Bugzilla Id: 59044

Modified:
    
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/config/gui/UrlConfigGui.java
    jmeter/trunk/xdocs/changes.xml

Modified: 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/config/gui/UrlConfigGui.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/config/gui/UrlConfigGui.java?rev=1731739&r1=1731738&r2=1731739&view=diff
==============================================================================
--- 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/config/gui/UrlConfigGui.java
 (original)
+++ 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/config/gui/UrlConfigGui.java
 Mon Feb 22 21:02:45 2016
@@ -48,6 +48,7 @@ import org.apache.jmeter.protocol.http.g
 import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;
 import org.apache.jmeter.protocol.http.sampler.HTTPSamplerFactory;
 import org.apache.jmeter.protocol.http.util.HTTPArgument;
+import org.apache.jmeter.protocol.http.util.HTTPConstants;
 import org.apache.jmeter.testelement.TestElement;
 import org.apache.jmeter.testelement.property.BooleanProperty;
 import org.apache.jmeter.testelement.property.JMeterProperty;
@@ -598,6 +599,7 @@ public class UrlConfigGui extends JPanel
         if (notConfigOnly){
             method = new JLabeledChoice(JMeterUtils.getResString("method"), // 
$NON-NLS-1$
                     HTTPSamplerBase.getValidMethodsAsArray());
+            method.addChangeListener(this);
         }
 
         JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
@@ -736,11 +738,16 @@ public class UrlConfigGui extends JPanel
                 followRedirects.setSelected(false);
             }
         }
-        if (e.getSource() == followRedirects){
+        else if (e.getSource() == followRedirects){
             if (followRedirects.isSelected()) {
                 autoRedirects.setSelected(false);
             }
         }
+        // disable the multi-part if not a post request
+        else if(e.getSource() == method) {
+            boolean isPostMethod = HTTPConstants.POST.equals(method.getText());
+            useMultipartForPost.setEnabled(isPostMethod);    
+        }
     }
 
 

Modified: jmeter/trunk/xdocs/changes.xml
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1731739&r1=1731738&r2=1731739&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Mon Feb 22 21:02:45 2016
@@ -262,6 +262,7 @@ Summary
     <li><bug>58844</bug>Buttons enable / disable is broken in the arguments 
panel. Contributed by Benoit Wiart (benoit dot wiart at gmail.com)</li>
     <li><bug>58861</bug>When clicking on up, down or detail while in a cell of 
the argument panel, newly added content is lost. Contributed by Benoit Wiart 
(benoit dot wiart at gmail.com)</li>
     <li><bug>57935</bug>SSL SNI extension not supported by HttpClient 
4.2.6</li>
+    <li><bug>59044</bug>Http Sampler : It should not be possible to select the 
multipart encoding if the method is not POST. Contributed by Benoit Wiart 
(benoit dot wiart at gmail.com)</li>
 </ul>
 
 <h3>Other Samplers</h3>


Reply via email to