Skip to content

Commit 5212e26

Browse files
committed
If Accept is not perfect gzon will seralize the wrong thing. fix #930
1 parent da5d8c4 commit 5212e26

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

jooby/src/test/java/org/jooby/test/JoobySuite.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ private List<Runner> runners(final Class<?> klass) throws InitializationError {
4141
filter = server::contains;
4242
}
4343
String[] servers = {"org.jooby.undertow.Undertow", "org.jooby.jetty.Jetty",
44-
};
44+
"org.jooby.netty.Netty" };
4545
for (String server : servers) {
4646
try {
4747
Class<?> serverClass = getClass().getClassLoader().loadClass(server);
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package org.jooby.issues;
2+
3+
import com.typesafe.config.ConfigFactory;
4+
import com.typesafe.config.ConfigValueFactory;
5+
import org.jooby.json.Gzon;
6+
import org.jooby.json.Jackson;
7+
import org.jooby.test.ServerFeature;
8+
import org.junit.Test;
9+
10+
public class Issue930 extends ServerFeature {
11+
12+
{
13+
use(ConfigFactory.empty().withValue("application.env", ConfigValueFactory.fromAnyRef("prod")));
14+
use(new Gzon());
15+
}
16+
17+
@Test
18+
public void gzonRenderJsonWithWideAcceptIsPresent() throws Exception {
19+
request()
20+
.get("/930")
21+
.header("Accept", "application/json, */*")
22+
.expect("{\"message\":\"Not Found(404): /930\",\"status\":404,\"reason\":\"Not Found\"}");
23+
24+
request()
25+
.get("/930")
26+
.header("Accept", "application/json")
27+
.expect("{\"message\":\"Not Found(404): /930\",\"status\":404,\"reason\":\"Not Found\"}");
28+
}
29+
30+
}

0 commit comments

Comments
 (0)