From 484917c4c433648728b47e6859ac0768ae343009 Mon Sep 17 00:00:00 2001 From: rnowacoski Date: Wed, 17 Aug 2022 15:25:11 -0700 Subject: [PATCH] Use ctx.bytes rather than getting the InputStream directly so that the contents of the InputStream are cached in the Request object --- cask/src/cask/endpoints/JsonEndpoint.scala | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cask/src/cask/endpoints/JsonEndpoint.scala b/cask/src/cask/endpoints/JsonEndpoint.scala index fbab2fa8e8..07de8920f8 100644 --- a/cask/src/cask/endpoints/JsonEndpoint.scala +++ b/cask/src/cask/endpoints/JsonEndpoint.scala @@ -50,9 +50,7 @@ class postJson(val path: String, override val subpath: Boolean = false) val obj = for{ str <- try { - val boas = new ByteArrayOutputStream() - Util.transferTo(ctx.exchange.getInputStream, boas) - Right(new String(boas.toByteArray)) + Right(new String(ctx.bytes)) } catch{case e: Throwable => Left(cask.model.Response( "Unable to deserialize input JSON text: " + e + "\n" + Util.stackTraceString(e),