http4k / org.http4k.filter / ClientFilters
ClientFilters
object ClientFilters
Types
Functions
Name |
Summary |
AcceptGZip |
Support for GZipped responses from clients.fun AcceptGZip(compressionMode: GzipCompressionMode = Memory): Filter |
ApiKeyAuth |
fun ApiKeyAuth(set: ( Request ) -> Request ): Filter |
CleanProxy |
This Filter is used to clean the Request and Response when proxying directly to another system. The purpose of this is to remove any routing metadata that we may have attached to it before sending it onwards.fun CleanProxy(): <ERROR CLASS> |
GZip |
Basic GZip and Gunzip support of Request/Response. Only Gunzip responses when the response contains “transfer-encoding” header containing ‘gzip’fun GZip(compressionMode: GzipCompressionMode = Memory): Filter |
RequestTracing |
Adds Zipkin request tracing headers to the outbound request. (traceid, spanid, parentspanid)fun RequestTracing(startReportFn: ( Request , ZipkinTraces ) -> Unit = { _, _ -> }, endReportFn: ( Request , Response , ZipkinTraces ) -> Unit = { _, _, _ -> }): Filter |
SetBaseUriFrom |
Sets the base uri (host + base path) on an outbound request. This is useful to separate configuration of remote endpoints from the logic required to construct the rest of the request.fun SetBaseUriFrom(uri: Uri ): Filter |
SetHostFrom |
Sets the host on an outbound request. This is useful to separate configuration of remote endpoints from the logic required to construct the rest of the request.fun SetHostFrom(uri: Uri ): Filter |
SetXForwardedHost |
Copy the Host header into the x-forwarded-host header of a request. Used when we are using proxies to divert traffic to another server.fun SetXForwardedHost(): <ERROR CLASS> |
Extension Properties
Extension Functions
Name |
Summary |
AwsAuth |
Sign AWS requests using static credentials.fun ClientFilters .AwsAuth(scope: AwsCredentialScope , credentials: AwsCredentials , clock: Clock = Clock.systemDefaultZone(), payloadMode: Mode = Payload.Mode.Signed): <ERROR CLASS> Sign AWS requests using dynamically provided (expiring) credentials.fun ClientFilters .AwsAuth(scope: AwsCredentialScope , credentialsProvider: () -> AwsCredentials , clock: Clock = Clock.systemDefaultZone(), payloadMode: Mode = Payload.Mode.Signed): <ERROR CLASS> |
HandleRemoteRequestFailed |
Convert errors from remote calls into exceptions which can be handled at a higher level. Optionally pass in:fun ClientFilters .HandleRemoteRequestFailed(responseWasSuccessful: Response .() -> Boolean = { status.successful }, responseToMessage: Response .() -> String = Response::bodyString): <ERROR CLASS> |
OpenTelemetryTracing |
fun ClientFilters .OpenTelemetryTracing(tracer: Tracer = Http4kOpenTelemetry.tracer, spanNamer: ( Request ) -> String = { it.uri.toString() }, error: ( Request , Throwable ) -> String = { _, t -> t.localizedMessage }): Filter |
SetAwsServiceUrl |
fun ClientFilters .SetAwsServiceUrl(serviceName: String , region: String ): Filter |