diff options
author | adamw <adam@warski.org> | 2017-08-31 15:20:33 +0200 |
---|---|---|
committer | adamw <adam@warski.org> | 2017-08-31 15:20:33 +0200 |
commit | 53829db6555e91de8170b87ca8511d46adfc5442 (patch) | |
tree | 6cb2cf28ce1d5fa8373358ea0c7ecd91511097e8 /tests/src/test/scala/com/softwaremill/sttp/BasicTests.scala | |
parent | 666755ede0d221c11c1eac6aac57ce3d18c42c8b (diff) | |
download | sttp-53829db6555e91de8170b87ca8511d46adfc5442.tar.gz sttp-53829db6555e91de8170b87ca8511d46adfc5442.tar.bz2 sttp-53829db6555e91de8170b87ca8511d46adfc5442.zip |
Breaking redirect loops
Diffstat (limited to 'tests/src/test/scala/com/softwaremill/sttp/BasicTests.scala')
-rw-r--r-- | tests/src/test/scala/com/softwaremill/sttp/BasicTests.scala | 11 |
1 files changed, 11 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 f2639b5..d43c43f 100644 --- a/tests/src/test/scala/com/softwaremill/sttp/BasicTests.scala +++ b/tests/src/test/scala/com/softwaremill/sttp/BasicTests.scala @@ -159,6 +159,9 @@ class BasicTests } ~ path("r4") { complete("819") + } ~ + path("loop") { + redirect("/redirect/loop", StatusCodes.Found) } } @@ -573,11 +576,13 @@ class BasicTests val r2 = sttp.post(uri"$endpoint/redirect/r2") val r3 = sttp.post(uri"$endpoint/redirect/r3") val r4response = "819" + val loop = sttp.post(uri"$endpoint/redirect/loop") name should "not redirect when redirects shouldn't be followed (temporary)" in { val resp = r1.followRedirects(false).send().force() resp.code should be(307) resp.body should be('left) + resp.history should be('empty) } name should "not redirect when redirects shouldn't be followed (permanent)" in { @@ -621,6 +626,12 @@ class BasicTests resp.history(1).code should be(308) resp.history(2).code should be(302) } + + name should "break redirect loops" in { + val resp = loop.send().force() + resp.code should be(0) + resp.history should have size (SttpHandler.MaxRedirects) + } } } |