From 90f7b3659bf5e437daeccf45c3b575dfbb322e19 Mon Sep 17 00:00:00 2001 From: Harry Laoulakos Date: Mon, 5 Feb 2024 02:11:08 +0200 Subject: [PATCH] fix-maxBufSize-less-than-preferredBufSize (#2109) * fix-maxBufSize-less-than-preferredBufSize fix-maxBufSize-less-than-preferredBufSize scalafmt * fix-maxBufSize-less-than-preferredBufSize --- .../src/main/scala/caliban/client/SelectionBuilder.scala | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/client/src/main/scala/caliban/client/SelectionBuilder.scala b/client/src/main/scala/caliban/client/SelectionBuilder.scala index 63b4def8b..b082abc3c 100644 --- a/client/src/main/scala/caliban/client/SelectionBuilder.scala +++ b/client/src/main/scala/caliban/client/SelectionBuilder.scala @@ -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`. @@ -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 {