Skip to content

Commit

Permalink
move json converter to object
Browse files Browse the repository at this point in the history
  • Loading branch information
diffitask committed Oct 30, 2023
1 parent ab020a2 commit 90f2cd4
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@ fun Application.configureRouting(ideStateKeeper: IdeStateKeeper, logger: Logger)
}
}

val jsonConverter = Gson()
object RoutingUtils {
val jsonConverter = Gson()
}

suspend fun ApplicationCall.respondJson(responseObject: Any, status: HttpStatusCode = HttpStatusCode.OK) {
this.respondText(
text = jsonConverter.toJson(responseObject),
text = RoutingUtils.jsonConverter.toJson(responseObject),
status = status
)
}
Expand Down

0 comments on commit 90f2cd4

Please sign in to comment.