forked from jooby-project/jooby
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIssue1338.java
More file actions
34 lines (29 loc) · 940 Bytes
/
Issue1338.java
File metadata and controls
34 lines (29 loc) · 940 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package io.jooby;
import io.jooby.junit.ServerTest;
import io.jooby.junit.ServerTestRunner;
import org.junit.jupiter.api.DisplayName;
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class Issue1338 {
@ServerTest
@DisplayName("Form should not fail when empty")
public void issue1338(ServerTestRunner runner) {
runner.define(app -> {
app.post("/1338/form", ctx -> ctx.form().toMap());
app.post("/1338/multipart", ctx -> ctx.form().toMap());
}).ready(client -> {
client.post("/1338/form", rsp -> {
assertEquals("{}", rsp.body().string());
});
given()
.port(client.getPort())
.contentType("multipart/form-data;")
.when()
.post("/1338/multipart")
.then()
.assertThat()
.body(equalTo("{}"));
});
}
}