diff options
author | adamw <adam@warski.org> | 2017-07-26 22:03:53 +0200 |
---|---|---|
committer | adamw <adam@warski.org> | 2017-07-26 22:03:53 +0200 |
commit | 1173aa8b702cd45afc106b3a07316a5812ffce50 (patch) | |
tree | ebaea4d5bcc160e483f5391805a0357098070e78 /tests/src | |
parent | c6657a682e3641a5b7bb751533f991cc041d9f5f (diff) | |
download | sttp-1173aa8b702cd45afc106b3a07316a5812ffce50.tar.gz sttp-1173aa8b702cd45afc106b3a07316a5812ffce50.tar.bz2 sttp-1173aa8b702cd45afc106b3a07316a5812ffce50.zip |
#2: onCompleted() in async-http-client-handler sometimes wasn't called, calling it earlier from onStream()
Diffstat (limited to 'tests/src')
-rw-r--r-- | tests/src/test/scala/com/softwaremill/sttp/StreamingTests.scala | 21 |
1 files changed, 21 insertions, 0 deletions
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("</div>") + } } } |