Skip to content

Commit

Permalink
fix-maxBufSize-less-than-preferredBufSize (#2109)
Browse files Browse the repository at this point in the history
* fix-maxBufSize-less-than-preferredBufSize

fix-maxBufSize-less-than-preferredBufSize scalafmt

* fix-maxBufSize-less-than-preferredBufSize
  • Loading branch information
harrylaou authored Feb 5, 2024
1 parent cd13787 commit 90f7b36
Showing 1 changed file with 5 additions and 2 deletions.
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

0 comments on commit 90f7b36

Please sign in to comment.