HttpClientConfig

wvlet.airframe.http.client.HttpClientConfig
case class HttpClientConfig(name: String, backend: HttpClientBackend, requestFilter: Request => Request, responseFilter: Response => Response, rpcEncoding: RPCEncoding, retryContext: RetryContext, codecFactory: MessageCodecFactory, circuitBreaker: CircuitBreaker, connectTimeout: Duration, readTimeout: Duration, clientFilter: RxHttpFilter, httpLoggerConfig: HttpLoggerConfig, httpLoggerProvider: HttpLoggerConfig => HttpLogger, loggingFilter: HttpLogger => HttpClientFilter) extends HttpChannelConfig

A common immutable configuration for all HTTP clients in airframe-http. To modify any configuration, use withXXX methods.

The generated HTTP client has multiple layers of filters:

  • requestFilter: A filter to modify the request before sending it to the backend. This can be used for adding common HTTP headers (e.g., User-Agent, Authentication header, etc.)
  • clientFilter: A filter to modify the request/response.
  • loggingFilter: A filter to log individual requests and responses, including retried requests. The default behavior is logging each request with its response stats to log/http_client.json file.
  • responseFilter: A filter to modify the response before returning it to the caller.

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def newAsyncClient(serverAddress: String): AsyncClient

Create a default Async client for Scala.js in web browsers

Create a default Async client for Scala.js in web browsers

Attributes

def newSyncClient(serverAddress: String): SyncClient

Remove any client-side filter

Remove any client-side filter

Attributes

Disable http-client side logging

Disable http-client side logging

Attributes

def withCircuitBreaker(f: CircuitBreaker => CircuitBreaker): HttpClientConfig

Add a new RxClientFilter. This filter is useful for adding a common error handling logic for the Rx[Response].

Add a new RxClientFilter. This filter is useful for adding a common error handling logic for the Rx[Response].

Attributes

def withCodecFactory(newCodecFactory: MessageCodecFactory): HttpClientConfig
def withConnectTimeout(duration: Duration): HttpClientConfig

Use Debug Console http logging

Use Debug Console http logging

Attributes

Customize logger configuration

Customize logger configuration

Attributes

def withName(name: String): HttpClientConfig
def withReadTimeout(duration: Duration): HttpClientConfig
def withRequestFilter(newRequestFilter: Request => Request): HttpClientConfig

Add a custom request filter, e.g., for adding Authentication headers

Add a custom request filter, e.g., for adding Authentication headers

Attributes

Add a custom response filter to the last response, mostly for debugging purpose

Add a custom response filter to the last response, mostly for debugging purpose

Attributes

def withRetryContext(filter: RetryContext => RetryContext): HttpClientConfig

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product