mstover1 2002/07/28 19:11:22
Modified: src_1/org/apache/jmeter/protocol/http/config UrlConfig.java
Log:
Posts maintain GET style arguments
Revision Changes Path
1.10 +33 -14
jakarta-jmeter/src_1/org/apache/jmeter/protocol/http/config/UrlConfig.java
Index: UrlConfig.java
===================================================================
RCS file:
/home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/protocol/http/config/UrlConfig.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- UrlConfig.java 3 Jul 2002 19:17:58 -0000 1.9
+++ UrlConfig.java 29 Jul 2002 02:11:22 -0000 1.10
@@ -138,17 +138,7 @@
*/
public void setPath(String path)
{
- int index = path.indexOf("?");
- if (index >= 0)
- {
- String queryString = path.substring(index + 1);
- setProperty(HTTPSampler.PATH, path.substring(0, index));
- parseArguments(queryString);
- }
- else
- {
- setProperty(HTTPSampler.PATH, path);
- }
+ setProperty(HTTPSampler.PATH, path);
}
public void addArgument(String name,String value)
@@ -188,7 +178,14 @@
if (this.getMethod().equals(HTTPSampler.GET) &&
getQueryString().length() > 0)
{
- pathAndQuery = this.getPath() + "?" + getQueryString();
+ if(this.getPath().indexOf("?") > -1)
+ {
+ pathAndQuery = this.getPath() + "&" + getQueryString();
+ }
+ else
+ {
+ pathAndQuery = this.getPath() + "?" + getQueryString();
+ }
}
else
{
@@ -404,6 +401,28 @@
config.setPath("/index.html");
config.setDomain("www.apache.org");
assertEquals("http://www.apache.org/index.html?param1=value1",config.getUrl().toString());
+ }
+
+ public void testMakingUrl2() throws Exception
+ {
+ UrlConfig config = new UrlConfig();
+ config.setProtocol("http");
+ config.setMethod(HTTPSampler.GET);
+ config.addArgument("param1","value1");
+ config.setPath("/index.html?p1=p2");
+ config.setDomain("www.apache.org");
+
assertEquals("http://www.apache.org/index.html?p1=p2¶m1=value1",config.getUrl().toString());
+ }
+
+ public void testMakingUrl3() throws Exception
+ {
+ UrlConfig config = new UrlConfig();
+ config.setProtocol("http");
+ config.setMethod(HTTPSampler.POST);
+ config.addArgument("param1","value1");
+ config.setPath("/index.html?p1=p2");
+ config.setDomain("www.apache.org");
+
assertEquals("http://www.apache.org/index.html?p1=p2",config.getUrl().toString());
}
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>