use of org.apache.jmeter.protocol.http.curl.BasicCurlParser in project jmeter by apache.
the class BasicCurlParserTest method testConfigureInProperties.
@Test
public void testConfigureInProperties() {
String cmdLine = "curl 'http://jmeter.apache.org/' --max-redirs 'b'";
BasicCurlParser basicCurlParser = new BasicCurlParser();
BasicCurlParser.Request request = basicCurlParser.parse(cmdLine);
assertTrue(request.getOptionsInProperties().contains("--max-redirs is in 'httpsampler.max_redirects(1062 line)'"), "Option max-redirs should show warning");
}
use of org.apache.jmeter.protocol.http.curl.BasicCurlParser in project jmeter by apache.
the class BasicCurlParserTest method testResolver.
@Test
public void testResolver() {
String cmdLine = "curl 'http://jmeter.apache.org/' --resolve 'moonagic.com:443:127.0.0.2'";
BasicCurlParser basicCurlParser = new BasicCurlParser();
BasicCurlParser.Request request = basicCurlParser.parse(cmdLine);
assertEquals("moonagic.com:443:127.0.0.2", request.getDnsResolver());
}
use of org.apache.jmeter.protocol.http.curl.BasicCurlParser in project jmeter by apache.
the class BasicCurlParserTest method testUnbalancedQuotes.
@Test
public void testUnbalancedQuotes() {
String cmdLine = "curl \"https://jmeter.apache.org/'";
BasicCurlParser basicCurlParser = new BasicCurlParser();
assertThrows(IllegalArgumentException.class, () -> basicCurlParser.parse(cmdLine), "The method 'translateCommandline shouldn't run when the quotes are not balanced,");
}
use of org.apache.jmeter.protocol.http.curl.BasicCurlParser in project jmeter by apache.
the class BasicCurlParserTest method testDataUrlEncodeOneParameterWithName.
@Test
public void testDataUrlEncodeOneParameterWithName() {
String cmdLine = "curl -s 'https://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_submit/action_page.php' " + "-H 'cache-control: no-cache' --data-urlencode 'value=é' ";
BasicCurlParser basicCurlParser = new BasicCurlParser();
BasicCurlParser.Request request = basicCurlParser.parse(cmdLine);
assertEquals("value=%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 testDataUrlEncodeFromFile.
@Test
public void testDataUrlEncodeFromFile() throws IOException {
String encoding = StandardCharsets.UTF_8.name();
FileUtils.writeStringToFile(tempFile, "test", encoding, true);
String pathname = tempFile.getAbsolutePath();
String cmdLine = "curl 'https://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_submit/action_page.php' " + "-H 'cache-control: no-cache' --data-urlencode 'name@" + pathname + "' ";
BasicCurlParser basicCurlParser = new BasicCurlParser();
BasicCurlParser.Request request = basicCurlParser.parse(cmdLine);
assertEquals("name=test", request.getPostData(), "With method 'parser',the parameters in the file need to be encoded' ");
}
Aggregations