From bca5626fbd6d1eef7f2ced773214dc31c8a9bbc8 Mon Sep 17 00:00:00 2001 From: Johannes Rudolph Date: Mon, 27 Oct 2014 10:42:54 +0100 Subject: [PATCH] =htc improve error messages --- .../main/scala/akka/http/engine/rendering/RenderSupport.scala | 4 ++-- .../akka/http/engine/rendering/ResponseRendererSpec.scala | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/akka-http-core/src/main/scala/akka/http/engine/rendering/RenderSupport.scala b/akka-http-core/src/main/scala/akka/http/engine/rendering/RenderSupport.scala index ef54fa28ee..ac8b80b173 100644 --- a/akka-http-core/src/main/scala/akka/http/engine/rendering/RenderSupport.scala +++ b/akka-http-core/src/main/scala/akka/http/engine/rendering/RenderSupport.scala @@ -68,13 +68,13 @@ private object RenderSupport { def onNext(elem: ByteString): List[ByteString] = { sent += elem.length if (sent > length) - throw new InvalidContentLengthException(s"HTTP message had declared Content-Length $length but entity chunk stream amounts to more bytes") + throw new InvalidContentLengthException(s"HTTP message had declared Content-Length $length but entity data stream amounts to more bytes") elem :: Nil } override def onTermination(e: Option[Throwable]): List[ByteString] = { if (sent < length) - throw new InvalidContentLengthException(s"HTTP message had declared Content-Length $length but entity chunk stream amounts to ${length - sent} bytes less") + throw new InvalidContentLengthException(s"HTTP message had declared Content-Length $length but entity data stream amounts to ${length - sent} bytes less") Nil } } diff --git a/akka-http-core/src/test/scala/akka/http/engine/rendering/ResponseRendererSpec.scala b/akka-http-core/src/test/scala/akka/http/engine/rendering/ResponseRendererSpec.scala index 27bfc788e4..b99f2a2dd6 100644 --- a/akka-http-core/src/test/scala/akka/http/engine/rendering/ResponseRendererSpec.scala +++ b/akka-http-core/src/test/scala/akka/http/engine/rendering/ResponseRendererSpec.scala @@ -141,14 +141,14 @@ class ResponseRendererSpec extends FreeSpec with Matchers with BeforeAndAfterAll the[RuntimeException] thrownBy { HttpResponse(200, entity = Default(ContentTypes.`application/json`, 10, source(ByteString("body123")))) should renderTo("") - } should have message "HTTP message had declared Content-Length 10 but entity chunk stream amounts to 3 bytes less" + } should have message "HTTP message had declared Content-Length 10 but entity data stream amounts to 3 bytes less" } "one chunk and incorrect (too small) Content-Length" in new TestSetup() { the[RuntimeException] thrownBy { HttpResponse(200, entity = Default(ContentTypes.`application/json`, 5, source(ByteString("body123")))) should renderTo("") - } should have message "HTTP message had declared Content-Length 5 but entity chunk stream amounts to more bytes" + } should have message "HTTP message had declared Content-Length 5 but entity data stream amounts to more bytes" } }