Closed wzy1935 closed 4 months ago
The test will fail for now cause there are errors in using Json.encodeToBuffer
and Json.decodeValue
. But I think that might be my version problem? Here's an example for reproduce:
JsonObject o = Json.decodeValue("{\"k2\":2}", JsonObject.class);
Gives:
Exception in thread "main" io.vertx.core.json.DecodeException: Failed to decode
at io.vertx.core.json.jackson.JacksonCodec.cast(JacksonCodec.java:418)
at io.vertx.core.json.jackson.JacksonCodec.fromParser(JacksonCodec.java:210)
at io.vertx.core.json.jackson.JacksonCodec.fromString(JacksonCodec.java:85)
at io.vertx.core.json.Json.decodeValue(Json.java:83)
at Scratch.main(Scratch.java:48)
The Javadoc of io.vertx.core.json.Json#decodeValue(java.lang.String, java.lang.Class<T>)
reads Decode a given JSON string to a POJO of the given class type.
You can't use this method to decode a payload to Vert.x JsonObject
. If you know the type the payload, use new JsonObject(str)
. If you don't use Json.decodeValue(str)
.
Can you rebase your PR and solve the conflicts please?
Updated, thank you! (tried a couple of times for rebase, sorry for the delay)
Related to issue 65. It adds a body interceptor to transform body (also in json format).
(Draft only, there's a potential bug that makes the test stuck)