anthony castillo
01/14/2020, 12:11 AMDico
01/14/2020, 12:51 AManthony castillo
01/14/2020, 1:46 AMval mapper: ObjectMapper = jacksonObjectMapper()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
.setSerializationInclusion(JsonInclude.Include.NON_NULL)
then we set it as a part of content negotiation feature
install(ContentNegotiation) {
register(ContentType.Application.Json, JacksonConverter(mapper))
}
however, we are unable to use the same mapper for HttpClient
val defaultHttpClient = HttpClient(OkHttp) {
expectSuccess = false
install(JsonFeature) {
this.serializer = JacksonSerializer {
configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
setSerializationInclusion(JsonInclude.Include.NON_NULL)
}
}
engine {
config {
readTimeout(Duration.ofMillis(2000))
connectTimeout(Duration.ofMillis(5000))
connectionPool(ConnectionPool(100, 1, TimeUnit.MINUTES))
}
}
}
anthony castillo
01/14/2020, 1:59 AMmapper
as wellDico
01/14/2020, 10:09 AMObjectMapper
insteadDico
01/14/2020, 10:09 AMDico
01/14/2020, 10:10 AManthony castillo
02/04/2020, 2:03 AM