Skip to content

Commit

Permalink
fix-maxBufSize-less-than-preferredBufSize
Browse files Browse the repository at this point in the history
fix-maxBufSize-less-than-preferredBufSize scalafmt
  • Loading branch information
harrylaou committed Feb 1, 2024
1 parent 9c3d9c9 commit 2788962
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 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,11 @@ sealed trait SelectionBuilder[-Origin, +A] { self =>
readFromString[GraphQLResponse](
payload,
// allow parsing of large payloads
ReaderConfig.withMaxBufSize(payload.length).withMaxCharBufSize(payload.length)
ReaderConfig
.withMaxBufSize(max(max(payload.length, ReaderConfig.maxBufSize), ReaderConfig.preferredBufSize))
.withMaxCharBufSize(
max(max(payload.length, ReaderConfig.maxCharBufSize), ReaderConfig.preferredCharBufSize)
)
)
)
catch {
Expand Down

0 comments on commit 2788962

Please sign in to comment.