Skip to content

Commit

Permalink
making not correctly ending json responses throw an exception instead…
Browse files Browse the repository at this point in the history
… of logging a warning, as per PR feedback
  • Loading branch information
duzinkie authored and martinbonnin committed Jun 14, 2024
1 parent 0d385dc commit 9185be6
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import com.apollographql.apollo3.api.json.writeArray
import com.apollographql.apollo3.exception.ApolloException
import com.apollographql.apollo3.exception.ApolloHttpException
import com.apollographql.apollo3.exception.DefaultApolloException
import com.apollographql.apollo3.exception.JsonDataException
import com.apollographql.apollo3.internal.CloseableSingleThreadDispatcher
import com.apollographql.apollo3.mpp.currentTimeMillis
import kotlinx.coroutines.CompletableDeferred
Expand Down Expand Up @@ -186,7 +187,7 @@ class BatchingHttpInterceptor @JvmOverloads constructor(
// TODO: this is most likely going to transform BigNumbers into strings, not sure how much of an issue that is
AnyAdapter.fromJson(jsonReader, CustomScalarAdapters.Empty).also {
if (jsonReader.peek() != JsonReader.Token.END_DOCUMENT) {
println("Apollo: extra tokens after payload")
throw JsonDataException("Expected END_DOCUMENT but was ${jsonReader.peek()}")
}
}
}
Expand Down

0 comments on commit 9185be6

Please sign in to comment.