Skip to content

Commit

Permalink
Ignore unknown keys in request JSON (#127)
Browse files Browse the repository at this point in the history
* Ignore Unknown keys in request JSON

* Fix test data class name

* Fix coverage
  • Loading branch information
koxudaxi committed Apr 18, 2021
1 parent a8fbbb0 commit d69a667
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 45 deletions.
1 change: 1 addition & 0 deletions kotlin/local-data-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ jacocoTestReport {
'**/localDataApi/SqlParameter.class',
'**/localDataApi/DataAPIException.class',
'**/localDataApi/ApplicationKt.class',
'**/localDataApi/Field.class',
]
)
}))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import io.ktor.response.*
import io.ktor.request.*
import io.ktor.routing.*
import io.ktor.serialization.*
import kotlinx.serialization.json.Json
import java.sql.ResultSet
import java.sql.SQLException
import java.sql.Statement
Expand All @@ -25,7 +26,7 @@ val secretManager = SecretManager.INSTANCE
fun Application.module(testing: Boolean = false) {
setup()
install(ContentNegotiation) {
json(DefaultJson, ContentType.Any)
json(Json { ignoreUnknownKeys = true }, ContentType.Any)
}
install(StatusPages) {
exception<SQLException> { cause ->
Expand Down
Loading

0 comments on commit d69a667

Please sign in to comment.