From 27889624a2c85848f494823defc6e4435021eff9 Mon Sep 17 00:00:00 2001 From: Harry Laoulakos Date: Thu, 1 Feb 2024 13:09:17 +0200 Subject: [PATCH] fix-maxBufSize-less-than-preferredBufSize fix-maxBufSize-less-than-preferredBufSize scalafmt --- .../src/main/scala/caliban/client/SelectionBuilder.scala | 9 +++++++-- 1 file changed, 7 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..22453423c 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,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 {