DumbResponse response = run(request, newWs("api/foo", a -> a.setHandler((req, resp) -> request.param("unknown"))));
- assertThat(response.stream().outputAsString()).isEqualTo("{\"errors\":[{\"msg\":\"BUG - parameter \\u0027unknown\\u0027 is undefined for action \\u0027foo\\u0027\"}]}");
+ assertThat(response.stream().outputAsString()).isEqualTo("{\"errors\":[{\"msg\":\"BUG - parameter 'unknown' is undefined for action 'foo'\"}]}");
assertThat(response.stream().status()).isEqualTo(400);
}
a.setHandler((req, resp) -> request.mandatoryParam("bar"));
}));
- assertThat(response.stream().outputAsString()).isEqualTo("{\"errors\":[{\"msg\":\"The \\u0027bar\\u0027 parameter is missing\"}]}");
+ assertThat(response.stream().outputAsString()).isEqualTo("{\"errors\":[{\"msg\":\"The 'bar' parameter is missing\"}]}");
assertThat(response.stream().status()).isEqualTo(400);
}
a.setHandler((req, resp) -> request.param("bar"));
}));
- assertThat(response.stream().outputAsString()).isEqualTo("{\"errors\":[{\"msg\":\"The \\u0027bar\\u0027 parameter is missing\"}]}");
+ assertThat(response.stream().outputAsString()).isEqualTo("{\"errors\":[{\"msg\":\"The 'bar' parameter is missing\"}]}");
assertThat(response.stream().status()).isEqualTo(400);
}
a.setHandler((req, resp) -> resp.stream().output().write(req.mandatoryParam("format").getBytes(UTF_8)));
}));
- assertThat(response.stream().outputAsString()).isEqualTo("{\"errors\":[{\"msg\":\"Value of parameter \\u0027format\\u0027 (yml) must be one of: [json, xml]\"}]}");
+ assertThat(response.stream().outputAsString()).isEqualTo("{\"errors\":[{\"msg\":\"Value of parameter 'format' (yml) must be one of: [json, xml]\"}]}");
assertThat(response.stream().status()).isEqualTo(400);
}
underTest.beginObject()
.prop("foo", "<hello \"world\">")
.endObject().close();
- expect("{\"foo\":\"\\u003chello \\\"world\\\"\\u003e\"}");
- }
-
- @Test
- public void escape_html_characters() {
- underTest.beginObject()
- .prop("foo", "123<>abc")
- .endObject().close();
- expect("{\"foo\":\"123\\u003c\\u003eabc\"}");
+ expect("{\"foo\":\"<hello \\\"world\\\">\"}");
}
@Test