Skip to content

Commit

Permalink
Add test case for tapir jsonitor max char size
Browse files Browse the repository at this point in the history
  • Loading branch information
kaaveland committed Nov 8, 2024
1 parent 9f04eb7 commit c90df59
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions adapters/play/src/test/scala/caliban/PlayAdapterSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import sttp.client3.UriContext
import zio._
import zio.test.{ Live, ZIOSpecDefault }

import java.util.Properties
import scala.language.postfixOps

object PlayAdapterSpec extends ZIOSpecDefault {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package caliban.interop.tapir
import caliban.InputValue.ObjectValue
import caliban.Value.StringValue
import caliban._
import com.github.plokhotnyuk.jsoniter_scala.core.{ readFromString, writeToString, JsonValueCodec }
import com.github.plokhotnyuk.jsoniter_scala.core.{ readFromString, writeToString, JsonValueCodec, ReaderConfig }
import com.github.plokhotnyuk.jsoniter_scala.macros.JsonCodecMaker
import sttp.capabilities.zio.ZioStreams
import sttp.capabilities.{ Effect, WebSockets }
Expand Down Expand Up @@ -272,6 +272,13 @@ object TapirAdapterSpec {
method = Method.GET.method,
query = """mutation{ deleteCharacter(name: "Amos Burton") }"""
).map(r => assertTrue(r.code.code == 400))
},
test("very long field values in mutations") {
val name = "A".repeat(ReaderConfig.maxCharBufSize + 1)
runHttpRequest(
method = Method.POST.method,
query = s"mutation { deleteCharacter(name: \"$name\") }"
).map(r => assertTrue(r.code.code == 200))
}
)
),
Expand Down

0 comments on commit c90df59

Please sign in to comment.