Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix-maxBufSize-less-than-preferredBufSize #2109

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions client/src/main/scala/caliban/client/SelectionBuilder.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import caliban.client.Operations.IsOperation
import caliban.client.Selection.Directive
import caliban.client.__Value.__ObjectValue
import com.github.plokhotnyuk.jsoniter_scala.core._

import sttp.client3._
import sttp.client3.jsoniter._
import sttp.model.Uri

import scala.collection.immutable.{ Map => SMap }
import scala.util.control.NonFatal
import scala.math.max

/**
* Represents a selection from parent type `Origin` that returns a result of type `A`.
Expand Down Expand Up @@ -73,7 +74,9 @@ sealed trait SelectionBuilder[-Origin, +A] { self =>
readFromString[GraphQLResponse](
payload,
// allow parsing of large payloads
ReaderConfig.withMaxBufSize(payload.length).withMaxCharBufSize(payload.length)
ReaderConfig
.withMaxBufSize(max(payload.length, ReaderConfig.maxBufSize))
.withMaxCharBufSize(max(payload.length, ReaderConfig.maxCharBufSize))
)
)
catch {
Expand Down