From 2c49b107726d365f33207deebc43a7a87274e8ad Mon Sep 17 00:00:00 2001 From: WhiteChi Date: Tue, 21 Nov 2023 11:58:32 +0800 Subject: [PATCH] `Shamrock`: fix #66 --- .../src/main/java/moe/fuqiuluo/shamrock/tools/KtorServer.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xposed/src/main/java/moe/fuqiuluo/shamrock/tools/KtorServer.kt b/xposed/src/main/java/moe/fuqiuluo/shamrock/tools/KtorServer.kt index 9a1fad8c..c784070c 100644 --- a/xposed/src/main/java/moe/fuqiuluo/shamrock/tools/KtorServer.kt +++ b/xposed/src/main/java/moe/fuqiuluo/shamrock/tools/KtorServer.kt @@ -170,12 +170,12 @@ suspend fun PipelineContext.fetchPostOrThrow(key: String) } fun PipelineContext.isJsonData(): Boolean { - return ContentType.Application.Json == call.request.contentType() || call.attributes[isJsonKey] + return ContentType.Application.Json == call.request.contentType() || (isJsonKey in call.attributes && call.attributes[isJsonKey]) } suspend fun PipelineContext.isJsonString(key: String): Boolean { if (!isJsonData()) return true - val data = if (call.attributes.contains(jsonKey)) { + val data = if (jsonKey in call.attributes) { call.attributes[jsonKey] } else { Json.parseToJsonElement(call.receiveText()).jsonObject.also {