Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

Commit

Permalink
Shamrock: fix #66
Browse files Browse the repository at this point in the history
  • Loading branch information
whitechi73 committed Nov 21, 2023
1 parent 4266afd commit 2c49b10
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,12 @@ suspend fun PipelineContext<Unit, ApplicationCall>.fetchPostOrThrow(key: String)
}

fun PipelineContext<Unit, ApplicationCall>.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<Unit, ApplicationCall>.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 {
Expand Down

1 comment on commit 2c49b10

@sd3970566
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

什么时候编译好啊···我想用最新的。

Please sign in to comment.