fix: コンテンツネゴシエーションするTypeを指定

This commit is contained in:
usbharu 2023-03-30 21:00:44 +09:00
parent 39a782927b
commit 761afc7159
Signed by: usbharu
GPG Key ID: 6556747BF94EEBC8
1 changed files with 4 additions and 1 deletions

View File

@ -12,10 +12,12 @@ import dev.usbharu.hideout.repository.UserAuthRepository
import dev.usbharu.hideout.repository.UserRepository import dev.usbharu.hideout.repository.UserRepository
import dev.usbharu.hideout.routing.* import dev.usbharu.hideout.routing.*
import dev.usbharu.hideout.service.* import dev.usbharu.hideout.service.*
import dev.usbharu.hideout.util.HttpUtil.Activity
import io.ktor.client.* import io.ktor.client.*
import io.ktor.client.engine.cio.* import io.ktor.client.engine.cio.*
import io.ktor.client.plugins.contentnegotiation.* import io.ktor.client.plugins.contentnegotiation.*
import io.ktor.client.plugins.logging.* import io.ktor.client.plugins.logging.*
import io.ktor.http.*
import io.ktor.serialization.jackson.* import io.ktor.serialization.jackson.*
import io.ktor.server.application.* import io.ktor.server.application.*
import org.jetbrains.exposed.sql.Database import org.jetbrains.exposed.sql.Database
@ -46,7 +48,8 @@ fun Application.module() {
single<HttpClient> { single<HttpClient> {
HttpClient(CIO) { HttpClient(CIO) {
install(ContentNegotiation) { install(ContentNegotiation) {
jackson {
jackson(ContentType.Application.Activity) {
enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY) enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
setSerializationInclusion(JsonInclude.Include.NON_EMPTY) setSerializationInclusion(JsonInclude.Include.NON_EMPTY)
configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)