Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1562,7 +1562,6 @@ protected String setupHttpEntityEnclosingRequestData(HttpEntityEnclosingRequestB
}
// Write the request to our own stream
MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create();
multipartEntityBuilder.setCharset(charset);
if (doBrowserCompatibleMultipart) {
multipartEntityBuilder.setLaxMode();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,22 @@ void testFileargWithMimeTypeWithCharset() throws Exception {
Assertions.assertTrue(requestData.contains("charset=utf-8"));
}

@Test
void testMultipartFormHeaderWithoutCharset() throws Exception {
HTTPSamplerBase sampler = (HTTPSamplerBase) new HttpTestSampleGui().createTestElement();
sampler.setThreadContext(jmctx);
sampler.setDoMultipart(true);
sampler.setDoBrowserCompatibleMultipart(true);
HttpEntityEnclosingRequestBase post = new HttpPost();
post.addHeader(HTTPConstants.HEADER_CONTENT_TYPE, "application/json; charset=utf-8");
sampler.setHTTPFiles(new HTTPFileArg[] {new HTTPFileArg("filename", "file", "application/octect; charset=utf-8")});
HTTPHC4Impl hc = new HTTPHC4Impl(sampler);
String requestData = hc.setupHttpEntityEnclosingRequestData(post);

String contentTypeWithEntity = post.getEntity().getContentType().getValue();
Assertions.assertFalse(contentTypeWithEntity.contains("charset"));
}

@Test
public void testNotifyFirstSampleAfterLoopRestartWhenThreadIterationIsSameUser() {
jmvars.putObject(SAME_USER, true);
Expand Down