Skip to content

Commit

Permalink
Merge pull request http4s/http4s#1424 from aeons/kleislis-all-over
Browse files Browse the repository at this point in the history
Deprecate Service and remove MaybeResponse
  • Loading branch information
aeons authored Oct 2, 2017
2 parents 2cb71d2 + 8dfbc4b commit 8953aef
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,22 @@ package org.http4s
package client
package asynchttpclient

import cats.data.Kleisli
import cats.effect._
import cats.effect.implicits._
import cats.implicits.{catsSyntaxEither => _, _}
import fs2._
import fs2.Stream._
import fs2._
import fs2.interop.reactivestreams.{StreamSubscriber, StreamUnicastPublisher}
import java.nio.ByteBuffer
import org.asynchttpclient.{Request => AsyncRequest, Response => _, _}
import org.asynchttpclient.AsyncHandler.State
import org.asynchttpclient.handler.StreamedAsyncHandler
import org.asynchttpclient.request.body.generator.{
BodyGenerator,
ByteArrayBodyGenerator,
ReactiveStreamsBodyGenerator
}
import org.asynchttpclient.{Request => AsyncRequest, Response => _, _}
import org.http4s.util.threads._
import org.reactivestreams.Publisher
import scala.collection.JavaConverters._
Expand Down Expand Up @@ -45,7 +46,7 @@ object AsyncHttpClient {
ec: ExecutionContext): Client[F] = {
val client = new DefaultAsyncHttpClient(config)
Client(
Service.lift { req: Request[F] =>
Kleisli { req =>
F.async[DisposableResponse[F]] { cb =>
client.executeRequest(toAsyncRequest(req), asyncHandler(cb))
()
Expand Down

0 comments on commit 8953aef

Please sign in to comment.