use of org.apache.jmeter.protocol.http.curl.BasicCurlParser in project jmeter by apache.
the class BasicCurlParserTest method testCacert.
@Test
public void testCacert() {
String cmdLine = "curl 'http://jmeter.apache.org/' --cacert 'test.pem' ";
BasicCurlParser basicCurlParser = new BasicCurlParser();
BasicCurlParser.Request request = basicCurlParser.parse(cmdLine);
assertEquals("cacert", 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 testHead.
@Test
public void testHead() {
String cmdLine = "curl 'http://jmeter.apache.org/' --head";
BasicCurlParser basicCurlParser = new BasicCurlParser();
BasicCurlParser.Request request = basicCurlParser.parse(cmdLine);
assertEquals("HEAD", request.getMethod());
}
use of org.apache.jmeter.protocol.http.curl.BasicCurlParser in project jmeter by apache.
the class BasicCurlParserTest method testError.
@Test
public void testError() {
String cmdLine = "curl 'https://jmeter.apache.org/' --error -H 'Proxy-Connection: keep-alive' " + "-H 'Proxy-Authorization: Basic XXXXXXXXX/' " + "-H 'User-Agent: Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko)" + " Chrome/70.0.3538.102 Mobile Safari/537.36' " + "-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8' " + "-H 'Accept-Encoding: gzip, deflate' " + "-H 'Accept-Language: en-US,en;q=0.9,fr;q=0.8'";
BasicCurlParser basicCurlParser = new BasicCurlParser();
assertThrows(IllegalArgumentException.class, () -> basicCurlParser.parse(cmdLine));
}
use of org.apache.jmeter.protocol.http.curl.BasicCurlParser in project jmeter by apache.
the class BasicCurlParserTest method testChromeParsing.
@Test
public void testChromeParsing() {
String cmdLine = "curl 'https://jmeter.apache.org/' -H 'Proxy-Connection: keep-alive' " + "-H 'Proxy-Authorization: Basic XXXXXXXXX/' -H 'Upgrade-Insecure-Requests: 1' " + "-H 'User-Agent: Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) " + "Chrome/70.0.3538.102 Mobile Safari/537.36' " + "-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8' " + "-H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.9,fr;q=0.8' --compressed";
BasicCurlParser basicCurlParser = new BasicCurlParser();
BasicCurlParser.Request request = basicCurlParser.parse(cmdLine);
assertEquals("https://jmeter.apache.org/", request.getUrl());
assertEquals(7, request.getHeaders().size());
assertTrue(request.isCompressed());
}
use of org.apache.jmeter.protocol.http.curl.BasicCurlParser in project jmeter by apache.
the class BasicCurlParserTest method testDefaultAuthMechanism.
@Test
public void testDefaultAuthMechanism() {
String cmdLine = "curl 'http://jmeter.apache.org/' -u 'arun:12345'";
BasicCurlParser basicCurlParser = new BasicCurlParser();
BasicCurlParser.Request request = basicCurlParser.parse(cmdLine);
assertEquals("BASIC", request.getAuthorization().getMechanism().toString());
}
Aggregations