use of org.apache.jmeter.protocol.http.curl.BasicCurlParser in project jmeter by apache.
the class BasicCurlParserTest method testReferer.
@Test
public void testReferer() {
String cmdLine = "curl 'http://jmeter.apache.org/' --referer 'www.baidu.com'";
BasicCurlParser basicCurlParser = new BasicCurlParser();
BasicCurlParser.Request request = basicCurlParser.parse(cmdLine);
assertTrue(request.getHeaders().contains(Pair.of("Referer", "www.baidu.com")));
}
use of org.apache.jmeter.protocol.http.curl.BasicCurlParser in project jmeter by apache.
the class BasicCurlParserTest method testCertStatus.
@Test
public void testCertStatus() {
String cmdLine = "curl 'http://jmeter.apache.org/' --cert-status ";
BasicCurlParser basicCurlParser = new BasicCurlParser();
BasicCurlParser.Request request = basicCurlParser.parse(cmdLine);
assertEquals("cert-status", request.getCaCert(), "With method 'parser',the cacert need to show a warning' ");
}
use of org.apache.jmeter.protocol.http.curl.BasicCurlParser in project jmeter by apache.
the class BasicCurlParserTest method testDataUrlEncodeOneParameterWithoutName.
@Test
public void testDataUrlEncodeOneParameterWithoutName() {
String cmdLine = "curl 'https://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_submit/action_page.php' " + "-H 'cache-control: no-cache' --data-urlencode 'é' ";
BasicCurlParser basicCurlParser = new BasicCurlParser();
BasicCurlParser.Request request = basicCurlParser.parse(cmdLine);
assertEquals("%C3%A9", request.getPostData(), "With method 'parser',the parameters need to be encoded' ");
}
use of org.apache.jmeter.protocol.http.curl.BasicCurlParser in project jmeter by apache.
the class BasicCurlParserTest method testAuthMechanismIsBasic.
@Test
public void testAuthMechanismIsBasic() {
String cmdLine = "curl 'http://jmeter.apache.org/' -u 'arun:12345' --basic";
BasicCurlParser basicCurlParser = new BasicCurlParser();
BasicCurlParser.Request request = basicCurlParser.parse(cmdLine);
assertEquals("BASIC", request.getAuthorization().getMechanism().toString());
}
use of org.apache.jmeter.protocol.http.curl.BasicCurlParser in project jmeter by apache.
the class BasicCurlParserTest method testGet.
@Test
public void testGet() {
String cmdLine = "curl -X POST \"https://api.imgur.com/3/upload\" " + " -H 'Authorization: Client-ID fb52f2bfa714a36' --data " + "'name=aaa%&lname=bbb' -G";
BasicCurlParser basicCurlParser = new BasicCurlParser();
BasicCurlParser.Request request = basicCurlParser.parse(cmdLine);
assertEquals("https://api.imgur.com/3/upload?name=aaa%&lname=bbb", request.getUrl(), "With method 'parser', it should put the post data in the url");
assertEquals("GET", request.getMethod(), "With method 'parser',the method should be 'GET'");
}
Aggregations