Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ object ArmeriaCatsBackend {
def resourceUsingClient[F[_]: Concurrent](client: WebClient): Resource[F, Backend[F]] =
Resource.make(Sync[F].delay(apply(client, closeFactory = true)))(_.close())

def usingDefaultClient[F[_]: Concurrent](): Backend[F] =
apply(newClient(), closeFactory = false)
def usingDefaultClient[F[_]: Concurrent](closeFactory: Boolean = false): Backend[F] =
apply(newClient(), closeFactory = closeFactory)

def usingClient[F[_]: Concurrent](client: WebClient): Backend[F] =
apply(client, closeFactory = false)
def usingClient[F[_]: Concurrent](client: WebClient, closeFactory: Boolean = false): Backend[F] =
apply(client, closeFactory = closeFactory)

private def apply[F[_]: Concurrent](
client: WebClient,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ object ArmeriaCatsBackend {
def resourceUsingClient[F[_]: Async](client: WebClient): Resource[F, Backend[F]] =
Resource.make(Sync[F].delay(apply(client, closeFactory = true)))(_.close())

def usingDefaultClient[F[_]: Async](): Backend[F] =
apply(newClient(), closeFactory = false)
def usingDefaultClient[F[_]: Async](closeFactory: Boolean = false): Backend[F] =
apply(newClient(), closeFactory = closeFactory)

def usingClient[F[_]: Async](client: WebClient): Backend[F] =
apply(client, closeFactory = false)
def usingClient[F[_]: Async](client: WebClient, closeFactory: Boolean = false): Backend[F] =
apply(client, closeFactory = closeFactory)

private def apply[F[_]: Async](
client: WebClient,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ object ArmeriaFs2Backend {
def resourceUsingClient[F[_]: ConcurrentEffect](client: WebClient): Resource[F, StreamBackend[F, Fs2Streams[F]]] =
Resource.make(Sync[F].delay(apply(client, closeFactory = true)))(_.close())

def usingClient[F[_]: ConcurrentEffect](client: WebClient): StreamBackend[F, Fs2Streams[F]] =
apply(client, closeFactory = false)
def usingClient[F[_]: ConcurrentEffect](client: WebClient, closeFactory: Boolean = false): StreamBackend[F, Fs2Streams[F]] =
apply(client, closeFactory = closeFactory)

def usingDefaultClient[F[_]: ConcurrentEffect](): StreamBackend[F, Fs2Streams[F]] =
apply(newClient(), closeFactory = false)
def usingDefaultClient[F[_]: ConcurrentEffect](closeFactory: Boolean = false): StreamBackend[F, Fs2Streams[F]] =
apply(newClient(), closeFactory = closeFactory)

private def apply[F[_]: ConcurrentEffect](
client: WebClient,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ object ArmeriaFs2Backend {
.parallel[F]
.flatMap(dispatcher => Resource.make(Sync[F].delay(apply(client, closeFactory = true, dispatcher)))(_.close()))

def usingClient[F[_]: Async](client: WebClient, dispatcher: Dispatcher[F]): StreamBackend[F, Fs2Streams[F]] =
apply(client, closeFactory = false, dispatcher)
def usingClient[F[_]: Async](client: WebClient, dispatcher: Dispatcher[F], closeFactory: Boolean = false): StreamBackend[F, Fs2Streams[F]] =
apply(client, closeFactory = closeFactory, dispatcher)

def usingDefaultClient[F[_]: Async](dispatcher: Dispatcher[F]): StreamBackend[F, Fs2Streams[F]] =
apply(newClient(), closeFactory = false, dispatcher)
def usingDefaultClient[F[_]: Async](dispatcher: Dispatcher[F], closeFactory: Boolean = false): StreamBackend[F, Fs2Streams[F]] =
apply(newClient(), closeFactory = closeFactory, dispatcher)

private def apply[F[_]: Async](
client: WebClient,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@ object ArmeriaMonixBackend {
apply(newClient(options), closeFactory = true)

/** @param scheduler The scheduler used for streaming request bodies. Defaults to the global scheduler. */
def usingClient(client: WebClient)(implicit
def usingClient(client: WebClient, closeFactory: Boolean = false)(implicit
scheduler: Scheduler = Scheduler.global
): StreamBackend[Task, MonixStreams] =
apply(client, closeFactory = false)
apply(client, closeFactory = closeFactory)

/** @param scheduler The scheduler used for streaming request bodies. Defaults to the global scheduler. */
def usingDefaultClient()(implicit
def usingDefaultClient(closeFactory: Boolean = false)(implicit
scheduler: Scheduler = Scheduler.global
): StreamBackend[Task, MonixStreams] =
apply(newClient(), closeFactory = false)
apply(newClient(), closeFactory = closeFactory)

private def apply(client: WebClient, closeFactory: Boolean)(implicit
scheduler: Scheduler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ object ArmeriaScalazBackend {
def apply(options: BackendOptions = BackendOptions.Default): Backend[Task] =
apply(newClient(options), closeFactory = true)

def usingClient(client: WebClient): Backend[Task] = apply(client, closeFactory = false)
def usingClient(client: WebClient, closeFactory: Boolean = false): Backend[Task] = apply(client, closeFactory = closeFactory)

def usingDefaultClient(): Backend[Task] = apply(newClient(), closeFactory = false)
def usingDefaultClient(closeFactory: Boolean = false): Backend[Task] = apply(newClient(), closeFactory = closeFactory)

private def apply(
client: WebClient,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ object ArmeriaFutureBackend {
def apply(options: BackendOptions = BackendOptions.Default): Backend[Future] =
apply(newClient(options), closeFactory = true)

def usingClient(client: WebClient): Backend[Future] =
apply(client, closeFactory = false)
def usingClient(client: WebClient, closeFactory: Boolean = false): Backend[Future] =
apply(client, closeFactory = closeFactory)

def usingDefaultClient(): Backend[Future] =
apply(newClient(), closeFactory = false)
def usingDefaultClient(closeFactory: Boolean = false): Backend[Future] =
apply(newClient(), closeFactory = closeFactory)

private def apply(client: WebClient, closeFactory: Boolean): Backend[Future] =
FollowRedirectsBackend(new ArmeriaFutureBackend(client, closeFactory))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,18 @@ object ArmeriaZioBackend {
def layer(options: BackendOptions = BackendOptions.Default): Layer[Throwable, SttpClient] =
ZLayer.scoped(scoped(options))

def usingClient(client: WebClient): Task[StreamBackend[Task, ZioStreams]] =
def usingClient(client: WebClient, closeFactory: Boolean = false): Task[StreamBackend[Task, ZioStreams]] =
ZIO
.runtime[Any]
.map(runtime => apply(runtime, client, closeFactory = false))
.map(runtime => apply(runtime, client, closeFactory = closeFactory))

def usingClient[R](runtime: Runtime[R], client: WebClient): StreamBackend[Task, ZioStreams] =
apply(runtime, client, closeFactory = false)
def usingClient[R](runtime: Runtime[R], client: WebClient, closeFactory: Boolean = false): StreamBackend[Task, ZioStreams] =
apply(runtime, client, closeFactory = closeFactory)

def usingDefaultClient(): Task[StreamBackend[Task, ZioStreams]] =
def usingDefaultClient(closeFactory: Boolean = false): Task[StreamBackend[Task, ZioStreams]] =
ZIO
.runtime[Any]
.map(runtime => apply(runtime, newClient(), closeFactory = false))
.map(runtime => apply(runtime, newClient(), closeFactory = closeFactory))

private def apply[R](runtime: Runtime[R], client: WebClient, closeFactory: Boolean): StreamBackend[Task, ZioStreams] =
wrappers.FollowRedirectsBackend(new ArmeriaZioBackend(runtime, client, closeFactory))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,18 @@ object ArmeriaZioBackend {
def layer(options: BackendOptions = BackendOptions.Default): Layer[Throwable, SttpClient] =
ZLayer.fromManaged(managed(options))

def usingClient(client: WebClient): Task[StreamBackend[Task, ZioStreams]] =
def usingClient(client: WebClient, closeFactory: Boolean = false): Task[StreamBackend[Task, ZioStreams]] =
ZIO
.runtime[Any]
.map(runtime => apply(runtime, client, closeFactory = false))
.map(runtime => apply(runtime, client, closeFactory = closeFactory))

def usingClient[R](runtime: Runtime[R], client: WebClient): StreamBackend[Task, ZioStreams] =
apply(runtime, client, closeFactory = false)
def usingClient[R](runtime: Runtime[R], client: WebClient, closeFactory: Boolean = false): StreamBackend[Task, ZioStreams] =
apply(runtime, client, closeFactory = closeFactory)

def usingDefaultClient(): Task[StreamBackend[Task, ZioStreams]] =
def usingDefaultClient(closeFactory: Boolean = false): Task[StreamBackend[Task, ZioStreams]] =
ZIO
.runtime[Any]
.map(runtime => apply(runtime, newClient(), closeFactory = false))
.map(runtime => apply(runtime, newClient(), closeFactory = closeFactory))

private def apply[R](runtime: Runtime[R], client: WebClient, closeFactory: Boolean): StreamBackend[Task, ZioStreams] =
wrappers.FollowRedirectsBackend(new ArmeriaZioBackend(runtime, client, closeFactory))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,10 @@ object OkHttpFutureBackend {
def usingClient(
client: OkHttpClient,
compressionHandlers: CompressionHandlers[Any, InputStream] = DefaultCompressionHandlers,
webSocketBufferCapacity: Option[Int] = OkHttpBackend.DefaultWebSocketBufferCapacity
webSocketBufferCapacity: Option[Int] = OkHttpBackend.DefaultWebSocketBufferCapacity,
closeClient: Boolean = false
)(implicit ec: ExecutionContext = ExecutionContext.global): WebSocketBackend[Future] =
OkHttpFutureBackend(client, closeClient = false, compressionHandlers, webSocketBufferCapacity)
OkHttpFutureBackend(client, closeClient = closeClient, compressionHandlers, webSocketBufferCapacity)

/** Create a stub backend for testing, which uses the [[Future]] response wrapper, and doesn't support streaming.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,10 @@ object OkHttpSyncBackend {
def usingClient(
client: OkHttpClient,
compressionHandlers: CompressionHandlers[Any, InputStream] = DefaultCompressionHandlers,
webSocketBufferCapacity: Option[Int] = OkHttpBackend.DefaultWebSocketBufferCapacity
webSocketBufferCapacity: Option[Int] = OkHttpBackend.DefaultWebSocketBufferCapacity,
closeClient: Boolean = false
): WebSocketSyncBackend =
OkHttpSyncBackend(client, closeClient = false, compressionHandlers, webSocketBufferCapacity)
OkHttpSyncBackend(client, closeClient = closeClient, compressionHandlers, webSocketBufferCapacity)

/** Create a stub backend for testing, which uses the [[Identity]] response wrapper, and doesn't support streaming.
*
Expand Down
Loading