Skip to content

Commit

Permalink
Add @transient annotation to isHttpGetRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
kyri-petrou committed Sep 15, 2024
1 parent 9eb9f65 commit 6990629
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/main/scala/caliban/GraphQLRequest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ case class GraphQLRequest(
operationName: Option[String] = None,
variables: Option[Map[String, InputValue]] = None,
extensions: Option[Map[String, InputValue]] = None,
isHttpGetRequest: Boolean = false
@transient isHttpGetRequest: Boolean = false
) { self =>

def withExtension(key: String, value: InputValue): GraphQLRequest =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ object GraphQLRequestJsoniterSpec extends ZIOSpecDefault {
writeToString(res) ==
"""{"query":"{}","operationName":"op","variables":{"hello":"world","answer":42,"isAwesome":true,"name":null}}"""
)
},
test("isHttpGetRequest is ignored when serializing to JSON") {
val res = writeToString(GraphQLRequest(isHttpGetRequest = true))
assertTrue(res == """{}""")
},
test("isHttpGetRequest is ignored when deserializing from JSON") {
val res = readFromString[GraphQLRequest]("""{"isHttpGetRequest":true}""").isHttpGetRequest
assertTrue(!res)
}
)
}

0 comments on commit 6990629

Please sign in to comment.