Issue #4400 - Review HttpClient's ContentProvider.

Review updates.
Closing MultiPartRequestContent before sending it.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2020-03-30 12:34:21 +02:00
parent 708115f609
commit e224be650b
2 changed files with 2 additions and 1 deletions

View File

@ -47,7 +47,6 @@ import static org.ops4j.pax.exam.CoreOptions.systemProperty;
* top of this.
*/
@RunWith(PaxExam.class)
public class TestJettyOSGiBootWithAnnotations
{
private static final String LOG_LEVEL = "WARN";
@ -135,6 +134,7 @@ public class TestJettyOSGiBootWithAnnotations
TestOSGiUtil.assertContains("Response contents", content, "<h1>FRAGMENT</h1>");
MultiPartRequestContent multiPart = new MultiPartRequestContent();
multiPart.addFieldPart("field", new StringRequestContent("foo"), null);
multiPart.close();
response = client.newRequest("http://127.0.0.1:" + port + "/multi").method("POST")
.body(multiPart).send();
assertEquals(HttpStatus.OK_200, response.getStatus());

View File

@ -267,6 +267,7 @@ public class HugeResourceTest
Path inputFile = staticBase.resolve(filename);
String name = String.format("file-%d", expectedSize);
multipart.addFilePart(name, filename, new PathRequestContent(inputFile), null);
multipart.close();
URI destUri = server.getURI().resolve("/multipart");
client.setIdleTimeout(90_000);