-
Notifications
You must be signed in to change notification settings - Fork 371
Closed
Labels
type: enhancementNew feature or requestNew feature or request
Description
Hi! In 7 version can i use different schema for authorized/unauthorized requests? In previous version i use it over:
suspend fun handle(applicationCall: ApplicationCall) {
val result = when {
applicationCall.containHeader("ADMIN_HEADER") -> {
if (applicationCall.request.hasCorrectAdminHeader()) {
fullGraphQLServer.execute(applicationCall.request)
} else {
delay(2_000)
applicationCall.response.call.respond(HttpStatusCode.Unauthorized, "No access")
return
}
}
applicationCall.containHeader("AUTH_HEADER") -> {
fullGraphQLServer.execute(applicationCall.request)
}
else -> {
guestGraphqlServer.execute(applicationCall.request)
}
}
if (result != null) {
val json = mapper.writeValueAsString(result)
applicationCall.response.call.respondText(contentType = ContentType.Application.Json, text = json)
} else {
applicationCall.response.call.respond(HttpStatusCode.BadRequest, "Invalid request")
}
}
How can now i do this?
Metadata
Metadata
Assignees
Labels
type: enhancementNew feature or requestNew feature or request