aboutsummaryrefslogtreecommitdiff
path: root/core/src/main
diff options
context:
space:
mode:
authoradamw <adam@warski.org>2018-02-20 09:56:42 +0100
committeradamw <adam@warski.org>2018-02-20 09:56:42 +0100
commit0f2ad1a1ef77364f0776232a88992e8cba30d28d (patch)
tree94eefd81a67c627f18ed0bb0185bc940157d7a12 /core/src/main
parent7178f4248121f06448eb6c1ead37521d94aed1e8 (diff)
downloadsttp-0f2ad1a1ef77364f0776232a88992e8cba30d28d.tar.gz
sttp-0f2ad1a1ef77364f0776232a88992e8cba30d28d.tar.bz2
sttp-0f2ad1a1ef77364f0776232a88992e8cba30d28d.zip
Brave backend
Diffstat (limited to 'core/src/main')
-rw-r--r--core/src/main/scala/com/softwaremill/sttp/FollowRedirectsBackend.scala4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/src/main/scala/com/softwaremill/sttp/FollowRedirectsBackend.scala b/core/src/main/scala/com/softwaremill/sttp/FollowRedirectsBackend.scala
index 3b88850..942f792 100644
--- a/core/src/main/scala/com/softwaremill/sttp/FollowRedirectsBackend.scala
+++ b/core/src/main/scala/com/softwaremill/sttp/FollowRedirectsBackend.scala
@@ -1,6 +1,7 @@
package com.softwaremill.sttp
import java.net.URI
+
import scala.language.higherKinds
class FollowRedirectsBackend[R[_], S](delegate: SttpBackend[R, S])
@@ -12,7 +13,8 @@ class FollowRedirectsBackend[R[_], S](delegate: SttpBackend[R, S])
private def sendWithCounter[T](request: Request[T, S],
redirects: Int): R[Response[T]] = {
- val resp = delegate.send(request)
+ // if there are nested follow redirect backends, disabling them and handling redirects here
+ val resp = delegate.send(request.followRedirects(false))
if (request.options.followRedirects) {
responseMonad.flatMap(resp) { response: Response[T] =>
if (response.isRedirect) {