override fun handleRequest()

in dsl/spring/spring-boot-lang/src/main/kotlin/io/kotless/dsl/spring/Kotless.kt [33:56]


    override fun handleRequest(input: InputStream, output: OutputStream, context: Context) {
        if (!prepared) {
            handler = SpringBootLambdaContainerHandler.getAwsProxyHandler(bootKlass.java)
            prepared = true
        }

        val json = input.bufferedReader().use { it.readText() }

        logger.debug("Started handling request")
        logger.trace("Request is {}", json)

        if (json.contains("Scheduled Event")) {
            val event = JSON.parse(CloudWatch.serializer(), json)
            if (event.`detail-type` == "Scheduled Event" && event.source == "aws.events") {
                logger.debug("Request is Scheduled Event")
                logger.debug("Nothing to do during warming")
                return
            }
        }

        logger.debug("Request is HTTP Event")

        handler?.proxyStream(json.byteInputStream(), output, context)
    }