diff options
author | Adam Warski <adam@warski.org> | 2018-04-24 11:25:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-24 11:25:45 +0200 |
commit | ba3879e9ce1a5fcaddec311daff4af73802c2c9a (patch) | |
tree | 980088d603d85e491bc1543894ed0fec8ff171f4 /core/src/main/scala/com/softwaremill/sttp/FollowRedirectsBackend.scala | |
parent | 06df22987e66372281430692351ee622ede570a1 (diff) | |
parent | 4e0ab8d83a92a07b40d85ff9ce5a6c9278b88b88 (diff) | |
download | sttp-ba3879e9ce1a5fcaddec311daff4af73802c2c9a.tar.gz sttp-ba3879e9ce1a5fcaddec311daff4af73802c2c9a.tar.bz2 sttp-ba3879e9ce1a5fcaddec311daff4af73802c2c9a.zip |
Merge pull request #82 from n4to4/config-max-redirects
Make max redirects configurable
Diffstat (limited to 'core/src/main/scala/com/softwaremill/sttp/FollowRedirectsBackend.scala')
-rw-r--r-- | core/src/main/scala/com/softwaremill/sttp/FollowRedirectsBackend.scala | 2 |
1 files changed, 1 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 96c0213..7004631 100644 --- a/core/src/main/scala/com/softwaremill/sttp/FollowRedirectsBackend.scala +++ b/core/src/main/scala/com/softwaremill/sttp/FollowRedirectsBackend.scala @@ -29,7 +29,7 @@ class FollowRedirectsBackend[R[_], S](delegate: SttpBackend[R, S]) extends SttpB private def followRedirect[T](request: Request[T, S], response: Response[T], redirects: Int): R[Response[T]] = { response.header(LocationHeader).fold(responseMonad.unit(response)) { loc => - if (redirects >= FollowRedirectsBackend.MaxRedirects) { + if (redirects >= request.options.maxRedirects) { responseMonad.unit(Response(Left("Too many redirects"), 0, "", Nil, Nil)) } else { followRedirect(request, response, redirects, loc) |