diff options
author | adamw <adam@warski.org> | 2017-09-04 16:27:43 +0200 |
---|---|---|
committer | adamw <adam@warski.org> | 2017-09-04 16:27:43 +0200 |
commit | 2761923dcf1ea49f7671cc2f18df9bd07f0df40b (patch) | |
tree | 1e20c4d823f0ff734d77c54e96ab738f4186c740 /okhttp-handler/src | |
parent | 41bbe08c125bb3714aee862ec9dc55419c29986d (diff) | |
download | sttp-2761923dcf1ea49f7671cc2f18df9bd07f0df40b.tar.gz sttp-2761923dcf1ea49f7671cc2f18df9bd07f0df40b.tar.bz2 sttp-2761923dcf1ea49f7671cc2f18df9bd07f0df40b.zip |
Extracting FollowRedirectsHandler as a wrapper-handler
Diffstat (limited to 'okhttp-handler/src')
-rw-r--r-- | okhttp-handler/src/main/scala/com/softwaremill/sttp/okhttp/OkHttpClientHandler.scala | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/okhttp-handler/src/main/scala/com/softwaremill/sttp/okhttp/OkHttpClientHandler.scala b/okhttp-handler/src/main/scala/com/softwaremill/sttp/okhttp/OkHttpClientHandler.scala index 5574417..327a752 100644 --- a/okhttp-handler/src/main/scala/com/softwaremill/sttp/okhttp/OkHttpClientHandler.scala +++ b/okhttp-handler/src/main/scala/com/softwaremill/sttp/okhttp/OkHttpClientHandler.scala @@ -148,7 +148,7 @@ object OkHttpHandler { class OkHttpSyncHandler private (client: OkHttpClient) extends OkHttpHandler[Id, Nothing](client) { - override protected def doSend[T](r: Request[T, Nothing]): Response[T] = { + override def send[T](r: Request[T, Nothing]): Response[T] = { val request = convertRequest(r) val response = client.newCall(request).execute() readResponse(response, r.response) @@ -160,13 +160,13 @@ class OkHttpSyncHandler private (client: OkHttpClient) object OkHttpSyncHandler { def apply(okhttpClient: OkHttpClient = OkHttpHandler.buildClientNoRedirects()) : SttpHandler[Id, Nothing] = - new OkHttpSyncHandler(okhttpClient) + new FollowRedirectsHandler[Id, Nothing](new OkHttpSyncHandler(okhttpClient)) } abstract class OkHttpAsyncHandler[R[_], S](client: OkHttpClient, rm: MonadAsyncError[R]) extends OkHttpHandler[R, S](client) { - override protected def doSend[T](r: Request[T, S]): R[Response[T]] = { + override def send[T](r: Request[T, S]): R[Response[T]] = { val request = convertRequest(r) rm.flatten(rm.async[R[Response[T]]] { cb => @@ -198,5 +198,6 @@ object OkHttpFutureHandler { okhttpClient: OkHttpClient = OkHttpHandler.buildClientNoRedirects())( implicit ec: ExecutionContext = ExecutionContext.Implicits.global) : SttpHandler[Future, Nothing] = - new OkHttpFutureHandler(okhttpClient) + new FollowRedirectsHandler[Future, Nothing]( + new OkHttpFutureHandler(okhttpClient)) } |