aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authoradamw <adam@warski.org>2017-07-19 15:24:45 +0200
committeradamw <adam@warski.org>2017-07-19 15:24:45 +0200
commit3991877faa003a072a175ae59b093beabbd21a50 (patch)
treeb988622cb73eb92f9af8a3881ac1f15d9e361f46 /tests
parentcc475bfae8163836c89ea64726e5e5d4d2fa36d3 (diff)
downloadsttp-3991877faa003a072a175ae59b093beabbd21a50.tar.gz
sttp-3991877faa003a072a175ae59b093beabbd21a50.tar.bz2
sttp-3991877faa003a072a175ae59b093beabbd21a50.zip
Mapping responses
Diffstat (limited to 'tests')
-rw-r--r--tests/src/test/scala/com/softwaremill/sttp/BasicTests.scala18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/src/test/scala/com/softwaremill/sttp/BasicTests.scala b/tests/src/test/scala/com/softwaremill/sttp/BasicTests.scala
index 621968b..2b3bbab 100644
--- a/tests/src/test/scala/com/softwaremill/sttp/BasicTests.scala
+++ b/tests/src/test/scala/com/softwaremill/sttp/BasicTests.scala
@@ -137,6 +137,24 @@ class BasicTests
response.body should be(expectedPostEchoResponse)
}
+ name should "parse response as string with mapping using map" in {
+ val response = postEcho
+ .body(testBody)
+ .response(asString.map(_.length))
+ .send()
+ .force()
+ response.body should be(expectedPostEchoResponse.length)
+ }
+
+ name should "parse response as string with mapping using mapResponse" in {
+ val response = postEcho
+ .body(testBody)
+ .mapResponse(_.length)
+ .send()
+ .force()
+ response.body should be(expectedPostEchoResponse.length)
+ }
+
name should "parse response as a byte array" in {
val response =
postEcho.body(testBody).response(asByteArray).send().force()