Hi,
Below is a whole unit test in my project, and it fails when using
`HTTP/1.0` protocol, success when using `HTTP/1.1`. Can somebody help
explain the reason?
// setup mock server
val json =
"""
|{"result":true}
""".stripMargin
val source = Source(ByteString(json) :: Nil)
val mockRoutes = path("test" / "proxy_chunked.do") {
get {
complete {
HttpResponse(StatusCodes.OK, entity =
HttpEntity(ContentTypes.`application/json`, source))
}
}
} ~ complete {
HttpResponse(StatusCodes.NotFound)
}
val (_, host, port) = AkkaHttpTestUtils.temporaryServerHostnameAndPort()
val bindingFuture = Http().bindAndHandle(mockRoutes, host, port)
val request = HttpRequest(
HttpMethods.GET,
uri = s"http://${host}:${port}/test/proxy_chunked.do",
protocol = HttpProtocols.`HTTP/1.0`
)
val futureByteString = Http().singleRequest(request).map { resp =>
println("response returned")
resp.entity.dataBytes
} flatMap { source =>
source.runFold(ByteString.empty)((r, bs) => r ++ bs)
}
val byteString = Await.result(futureByteString, 10 seconds)
byteString.utf8String shouldEqual (json)
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.