Add response type

This commit is contained in:
Alexander Nozik 2022-12-06 22:51:09 +03:00
parent e95f73d94d
commit 17d681bd42
No known key found for this signature in database
GPG Key ID: F7FCF2DD25C71357

View File

@ -1,5 +1,6 @@
package ru.inr.mass.data.server
import io.ktor.http.ContentType
import io.ktor.http.HttpStatusCode
import io.ktor.server.application.Application
import io.ktor.server.application.call
@ -86,7 +87,7 @@ public fun Application.numassModule() {
}
get("/repository") {
call.respondText {
call.respondText(ContentType.Application.Json) {
visionManager.encodeToString(VisionOfNumassRepository(Name.EMPTY, repository))
}
}
@ -106,7 +107,7 @@ public fun Application.numassModule() {
return@get
}
call.respondText {
call.respondText(ContentType.Application.Json) {
visionManager.encodeToString(VisionOfNumassSet(setName, set))
}
}
@ -135,7 +136,7 @@ public fun Application.numassModule() {
call.respondText(status = HttpStatusCode.NotFound) { "A point with name $setName/$pointIndex not found in the repository" }
return@get
}
call.respondText {
call.respondText(ContentType.Application.Json) {
visionManager.encodeToString(point.toVision())
}
}