diff options
Diffstat (limited to 'tests/src/test/scala/com/softwaremill/sttp/BasicTests.scala')
-rw-r--r-- | tests/src/test/scala/com/softwaremill/sttp/BasicTests.scala | 14 |
1 files changed, 14 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 1d03154..392f6d8 100644 --- a/tests/src/test/scala/com/softwaremill/sttp/BasicTests.scala +++ b/tests/src/test/scala/com/softwaremill/sttp/BasicTests.scala @@ -631,6 +631,20 @@ class BasicTests resp.code should be(0) resp.history should have size (FollowRedirectsBackend.MaxRedirects) } + + name should "break redirect loops after user-specified count" in { + val maxRedirects = 10 + val resp = loop.maxRedirects(maxRedirects).send().force() + resp.code should be(0) + resp.history should have size (maxRedirects) + } + + name should "not redirect when maxRedirects is less than or equal to 0" in { + val resp = loop.maxRedirects(-1).send().force() + resp.code should be(302) + resp.body should be('left) + resp.history should be('empty) + } } def timeoutTests(): Unit = { |