diff options
author | n4to4 <n4to4k@gmail.com> | 2018-04-24 18:19:50 +0900 |
---|---|---|
committer | n4to4 <n4to4k@gmail.com> | 2018-04-24 18:23:21 +0900 |
commit | 4e0ab8d83a92a07b40d85ff9ce5a6c9278b88b88 (patch) | |
tree | 980088d603d85e491bc1543894ed0fec8ff171f4 /core/src/main/scala/com/softwaremill/sttp/RequestT.scala | |
parent | 9406043b822a3aa9a7ef27630036a91cc3e7ed3a (diff) | |
download | sttp-4e0ab8d83a92a07b40d85ff9ce5a6c9278b88b88.tar.gz sttp-4e0ab8d83a92a07b40d85ff9ce5a6c9278b88b88.tar.bz2 sttp-4e0ab8d83a92a07b40d85ff9ce5a6c9278b88b88.zip |
Set `followRedirects` explicitly, and disable redirects if `maxRedirects <= 0`
Diffstat (limited to 'core/src/main/scala/com/softwaremill/sttp/RequestT.scala')
-rw-r--r-- | core/src/main/scala/com/softwaremill/sttp/RequestT.scala | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/core/src/main/scala/com/softwaremill/sttp/RequestT.scala b/core/src/main/scala/com/softwaremill/sttp/RequestT.scala index 7b3eab9..082a75a 100644 --- a/core/src/main/scala/com/softwaremill/sttp/RequestT.scala +++ b/core/src/main/scala/com/softwaremill/sttp/RequestT.scala @@ -230,7 +230,10 @@ case class RequestT[U[_], T, +S]( this.copy(options = options.copy(followRedirects = fr)) def maxRedirects(n: Int): RequestT[U, T, S] = - this.copy(options = options.copy(maxRedirects = n)) + if (n <= 0) + this.copy(options = options.copy(followRedirects = false)) + else + this.copy(options = options.copy(followRedirects = true, maxRedirects = n)) def tag(k: String, v: Any): RequestT[U, T, S] = this.copy(tags = tags + (k -> v)) |