Skip to content

Commit

Permalink
closes #3400
Browse files Browse the repository at this point in the history
  • Loading branch information
kliushnichenko authored and jknack committed Apr 16, 2024
1 parent cb5c123 commit 3aabd07
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 2 deletions.
3 changes: 1 addition & 2 deletions jooby/src/main/java/io/jooby/internal/RouterImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -908,8 +908,7 @@ private void copy(Route src, Route it) {
it.setExecutorKey(src.getExecutorKey());
it.setTags(src.getTags());
it.setDescription(src.getDescription());
it.setDecoders(src.getDecoders());
it.setMvcMethod(it.getMvcMethod());
it.setMvcMethod(src.getMvcMethod());
it.setNonBlocking(src.isNonBlocking());
it.setSummary(src.getSummary());
}
Expand Down
39 changes: 39 additions & 0 deletions tests/src/test/java/io/jooby/i3400/Issue3400.java
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"));
});
});
}
}
27 changes: 27 additions & 0 deletions tests/src/test/java/io/jooby/i3400/Pet.java
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;
}
}

0 comments on commit 3aabd07

Please sign in to comment.