diff options
Diffstat (limited to 'kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl')
-rw-r--r-- | kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVController.kt | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVController.kt b/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVController.kt index 128933f2..50544dc1 100644 --- a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVController.kt +++ b/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVController.kt @@ -39,17 +39,16 @@ open class KVController { method = [RequestMethod.POST, RequestMethod.PUT, RequestMethod.DELETE, RequestMethod.OPTIONS] ) open fun kVMapping(req: HttpServletRequest, res: HttpServletResponse) { - val method = req.method val routeUrl = req.requestURI - val route = kvServer.services.map { - when (method) { + val route = kvServer.services.mapNotNull { + when (req.method) { "POST" -> it.postRequests[routeUrl] "PUT" -> it.putRequests[routeUrl] "DELETE" -> it.deleteRequests[routeUrl] "OPTIONS" -> it.optionsRequests[routeUrl] else -> null } - }.find { it != null } + }.firstOrNull() if (route != null) { route.invoke(req, res) } else { |