From e5b71326fdd547bce8b0f62a2bdd5a51a4a9017e Mon Sep 17 00:00:00 2001 From: lisonge Date: Mon, 25 Dec 2023 23:51:53 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20ktor=20=E8=BF=87=E6=BB=A4=E6=97=A5?= =?UTF-8?q?=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/kotlin/li/songe/gkd/debug/KtorErrorPlugin.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/li/songe/gkd/debug/KtorErrorPlugin.kt b/app/src/main/kotlin/li/songe/gkd/debug/KtorErrorPlugin.kt index d0dcc15..1456662 100644 --- a/app/src/main/kotlin/li/songe/gkd/debug/KtorErrorPlugin.kt +++ b/app/src/main/kotlin/li/songe/gkd/debug/KtorErrorPlugin.kt @@ -6,13 +6,15 @@ import io.ktor.http.HttpStatusCode import io.ktor.server.application.createApplicationPlugin import io.ktor.server.application.hooks.CallFailed import io.ktor.server.request.uri -import io.ktor.server.response.header import io.ktor.server.response.respond import li.songe.gkd.data.RpcError val KtorErrorPlugin = createApplicationPlugin(name = "KtorErrorPlugin") { onCall { call -> - Log.d("Ktor", "onCall: ${call.request.uri}") + // TODO 在局域网会被扫描工具批量请求多个路径 + if (call.request.uri == "/" || call.request.uri.startsWith("/api/")) { + Log.d("Ktor", "onCall: ${call.request.uri}") + } } on(CallFailed) { call, cause -> when (cause) {