diff --git a/pom.xml b/pom.xml index e5506f0..d0d533f 100644 --- a/pom.xml +++ b/pom.xml @@ -47,8 +47,8 @@ 1.22.0 3.20.0 2.0.62 - 31.0.1-jre - 2.17.2 + 33.8.0-jre + 2.22.3 6.1.0 1.18.46 4.9.3 diff --git a/src/test/java/io/agora/cloud/AgoraOkHttp3TemplateTest.java b/src/test/java/io/agora/cloud/AgoraOkHttp3TemplateTest.java index bb3bd16..d21c73d 100644 --- a/src/test/java/io/agora/cloud/AgoraOkHttp3TemplateTest.java +++ b/src/test/java/io/agora/cloud/AgoraOkHttp3TemplateTest.java @@ -195,6 +195,21 @@ void shouldCreateRequestBuilderWithBody() throws Exception { assertNotNull(builder); } + @Test + void shouldSerializeGuavaRequestBodyWithJackson() throws Exception { + okhttp3.HttpUrl url = okhttp3.HttpUrl.parse("http://localhost/api"); + java.util.Map body = com.google.common.collect.ImmutableMap.of( + "channel", "room-1", "uid", 42); + Request request = template.createRequestBuilder(url, + AgoraOkHttp3Template.HttpMethod.POST, null, body).build(); + okio.Buffer buffer = new okio.Buffer(); + request.body().writeTo(buffer); + com.fasterxml.jackson.databind.JsonNode json = new ObjectMapper().readTree(buffer.readUtf8()); + assertEquals("room-1", json.get("channel").asText()); + assertEquals(42, json.get("uid").asInt()); + assertEquals("application/json;charset=UTF-8", request.body().contentType().toString()); + } + // --- MediaType constants --- @Test void shouldHaveMediaTypeConstants() {