String titleValue = "mytitle";
String descriptionValue = "mydescription";
String postBody = createMultipartFormBody(titleValue, descriptionValue, contentEncoding, true, boundary, endOfLine);
String testPostRequest = createMultipartFormRequest(url, postBody, contentEncoding, boundary, endOfLine);
HTTPSamplerBase s = getSamplerForRequest(url, testPostRequest, contentEncoding);
assertEquals(HTTPSamplerBase.POST, s.getMethod());
assertEquals(contentEncoding, s.getContentEncoding());
assertTrue(s.getDoMultipartPost());
// Check arguments
Arguments arguments = s.getArguments();
assertEquals(2, arguments.getArgumentCount());
checkArgument((HTTPArgument)arguments.getArgument(0), "title", titleValue, titleValue, contentEncoding, false);
checkArgument((HTTPArgument)arguments.getArgument(1), "description", descriptionValue, descriptionValue, contentEncoding, false);
// A HTTP POST request, multipart/form-data, simple values,
// with \r\n as end of line, which is according to spec,
// and with more headers in each multipart
endOfLine = "\r\n";
titleValue = "mytitle";
descriptionValue = "mydescription";
postBody = createMultipartFormBody(titleValue, descriptionValue, contentEncoding, true, boundary, endOfLine);
testPostRequest = createMultipartFormRequest(url, postBody, contentEncoding, boundary, endOfLine);
s = getSamplerForRequest(url, testPostRequest, contentEncoding);
assertEquals(HTTPSamplerBase.POST, s.getMethod());
assertEquals(contentEncoding, s.getContentEncoding());
assertTrue(s.getDoMultipartPost());
// Check arguments
arguments = s.getArguments();
assertEquals(2, arguments.getArgumentCount());
checkArgument((HTTPArgument)arguments.getArgument(0), "title", titleValue, titleValue, contentEncoding, false);
checkArgument((HTTPArgument)arguments.getArgument(1), "description", descriptionValue, descriptionValue, contentEncoding, false);
// A HTTP POST request, multipart/form-data, simple values,
// with \n as end of line, which should also be handled,
// and with more headers in each multipart
endOfLine = "\n";
titleValue = "mytitle";
descriptionValue = "mydescription";
postBody = createMultipartFormBody(titleValue, descriptionValue, contentEncoding, true, boundary, endOfLine);
testPostRequest = createMultipartFormRequest(url, postBody, contentEncoding, boundary, endOfLine);
s = getSamplerForRequest(url, testPostRequest, contentEncoding);
assertEquals(HTTPSamplerBase.POST, s.getMethod());
assertEquals(contentEncoding, s.getContentEncoding());
assertTrue(s.getDoMultipartPost());
// Check arguments
arguments = s.getArguments();
assertEquals(2, arguments.getArgumentCount());
checkArgument((HTTPArgument)arguments.getArgument(0), "title", titleValue, titleValue, contentEncoding, false);
checkArgument((HTTPArgument)arguments.getArgument(1), "description", descriptionValue, descriptionValue, contentEncoding, false);
// A HTTP POST request, multipart/form-data, with value that will change
// if they are url encoded
// Values are similar to __VIEWSTATE parameter that .net uses
endOfLine = "\r\n";
titleValue = "/wEPDwULLTE2MzM2OTA0NTYPZBYCAgMPZ/rA+8DZ2dnZ2dnZ2d/GNDar6OshPwdJc=";
descriptionValue = "mydescription";
postBody = createMultipartFormBody(titleValue, descriptionValue, contentEncoding, true, boundary, endOfLine);
testPostRequest = createMultipartFormRequest(url, postBody, contentEncoding, boundary, endOfLine);
s = getSamplerForRequest(url, testPostRequest, contentEncoding);
assertEquals(HTTPSamplerBase.POST, s.getMethod());
assertEquals(contentEncoding, s.getContentEncoding());
assertTrue(s.getDoMultipartPost());
// Check arguments
arguments = s.getArguments();
assertEquals(2, arguments.getArgumentCount());
checkArgument((HTTPArgument)arguments.getArgument(0), "title", titleValue, titleValue, contentEncoding, false);
checkArgument((HTTPArgument)arguments.getArgument(1), "description", descriptionValue, descriptionValue, contentEncoding, false);
}