-
-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cb5c123
commit 3aabd07
Showing
3 changed files
with
67 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package io.jooby.i3400; | ||
|
||
import io.jooby.Jooby; | ||
import io.jooby.jackson.JacksonModule; | ||
import io.jooby.junit.ServerTest; | ||
import io.jooby.junit.ServerTestRunner; | ||
import okhttp3.MediaType; | ||
import okhttp3.RequestBody; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class Issue3400 { | ||
|
||
static class AppA extends Jooby { | ||
{ | ||
post("/pets", ctx -> ctx.body(Pet.class)); | ||
} | ||
} | ||
|
||
@ServerTest | ||
public void shouldShareDecodersOnMountedResources(ServerTestRunner runner) { | ||
runner | ||
.define( | ||
app -> { | ||
app.install(new JacksonModule()); | ||
app.mount(new AppA()); | ||
}) | ||
.ready( | ||
http -> { | ||
http.post( | ||
"/pets", | ||
RequestBody.create("{\"id\": 1, \"name\": \"Cheddar\"}", MediaType.parse("application/json")), | ||
rsp -> { | ||
assertEquals("{\"id\":1,\"name\":\"Cheddar\"}", rsp.body().string()); | ||
assertEquals("application/json;charset=UTF-8", rsp.header("Content-Type")); | ||
}); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package io.jooby.i3400; | ||
|
||
class Pet { | ||
private int id; | ||
private String name; | ||
|
||
public Pet(int id, String name) { | ||
this.id = id; | ||
this.name = name; | ||
} | ||
|
||
public int getId() { | ||
return id; | ||
} | ||
|
||
public void setId(int id) { | ||
this.id = id; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
} |