From 1173aa8b702cd45afc106b3a07316a5812ffce50 Mon Sep 17 00:00:00 2001 From: adamw Date: Wed, 26 Jul 2017 22:03:53 +0200 Subject: #2: onCompleted() in async-http-client-handler sometimes wasn't called, calling it earlier from onStream() --- .../com/softwaremill/sttp/StreamingTests.scala | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'tests/src/test/scala') diff --git a/tests/src/test/scala/com/softwaremill/sttp/StreamingTests.scala b/tests/src/test/scala/com/softwaremill/sttp/StreamingTests.scala index 5e6db17..7bc842c 100644 --- a/tests/src/test/scala/com/softwaremill/sttp/StreamingTests.scala +++ b/tests/src/test/scala/com/softwaremill/sttp/StreamingTests.scala @@ -105,5 +105,26 @@ class StreamingTests new String(bytes, "utf-8") should be(body) } + + it should "receive a stream from an https site" in { + val response = sttp + // of course, you should never rely on the internet being available + // in tests, but that's so much easier than setting up an https + // testing server + .get(uri"https://softwaremill.com") + .response(asStream[Observable[ByteBuffer]]) + .send() + .runAsync + .futureValue + + val bytes = response.body + .flatMap(bb => Observable.fromIterable(bb.array())) + .toListL + .runAsync + .futureValue + .toArray + + new String(bytes, "utf-8") should include("") + } } } -- cgit v1.2.3