=htc do not mention source in HttpEntity.toString (#20739) (#20971)

This commit is contained in:
Lev Khomich 2016-07-18 15:14:06 +06:00 committed by Konrad Malawski
parent 8047f3359f
commit 8f19dfcece
2 changed files with 25 additions and 0 deletions

View file

@ -369,6 +369,10 @@ object HttpEntity {
override def productPrefix = "HttpEntity.Default" override def productPrefix = "HttpEntity.Default"
override def toString: String = {
s"$productPrefix($contentType,$contentLength bytes total)"
}
/** Java API */ /** Java API */
override def getContentLength = contentLength override def getContentLength = contentLength
} }
@ -414,6 +418,10 @@ object HttpEntity {
override def withData(data: Source[ByteString, Any]): HttpEntity.CloseDelimited = copy(data = data) override def withData(data: Source[ByteString, Any]): HttpEntity.CloseDelimited = copy(data = data)
override def productPrefix = "HttpEntity.CloseDelimited" override def productPrefix = "HttpEntity.CloseDelimited"
override def toString: String = {
s"$productPrefix($contentType)"
}
} }
/** /**
@ -431,6 +439,10 @@ object HttpEntity {
override def withData(data: Source[ByteString, Any]): HttpEntity.IndefiniteLength = copy(data = data) override def withData(data: Source[ByteString, Any]): HttpEntity.IndefiniteLength = copy(data = data)
override def productPrefix = "HttpEntity.IndefiniteLength" override def productPrefix = "HttpEntity.IndefiniteLength"
override def toString: String = {
s"$productPrefix($contentType)"
}
} }
/** /**
@ -469,6 +481,10 @@ object HttpEntity {
override def productPrefix = "HttpEntity.Chunked" override def productPrefix = "HttpEntity.Chunked"
override def toString: String = {
s"$productPrefix($contentType)"
}
/** Java API */ /** Java API */
def getChunks: stream.javadsl.Source[jm.HttpEntity.ChunkStreamPart, AnyRef] = def getChunks: stream.javadsl.Source[jm.HttpEntity.ChunkStreamPart, AnyRef] =
stream.javadsl.Source.fromGraph(chunks.asInstanceOf[Source[jm.HttpEntity.ChunkStreamPart, AnyRef]]) stream.javadsl.Source.fromGraph(chunks.asInstanceOf[Source[jm.HttpEntity.ChunkStreamPart, AnyRef]])

View file

@ -141,14 +141,23 @@ class HttpEntitySpec extends FreeSpec with MustMatchers with BeforeAndAfterAll {
"Default" in { "Default" in {
val entity = Default(tpe, 11, source(abc, de, fgh, ijk)) val entity = Default(tpe, 11, source(abc, de, fgh, ijk))
entity.toString must include(entity.productPrefix) entity.toString must include(entity.productPrefix)
entity.toString must include("11")
entity.toString mustNot include("Source")
} }
"CloseDelimited" in { "CloseDelimited" in {
val entity = CloseDelimited(tpe, source(abc, de, fgh, ijk)) val entity = CloseDelimited(tpe, source(abc, de, fgh, ijk))
entity.toString must include(entity.productPrefix) entity.toString must include(entity.productPrefix)
entity.toString mustNot include("Source")
} }
"Chunked" in { "Chunked" in {
val entity = Chunked(tpe, source(Chunk(abc))) val entity = Chunked(tpe, source(Chunk(abc)))
entity.toString must include(entity.productPrefix) entity.toString must include(entity.productPrefix)
entity.toString mustNot include("Source")
}
"IndefiniteLength" in {
val entity = IndefiniteLength(tpe, source(abc, de, fgh, ijk))
entity.toString must include(entity.productPrefix)
entity.toString mustNot include("Source")
} }
} }
"support withoutSizeLimit" - { "support withoutSizeLimit" - {