JsonFeature

class JsonFeature

HttpClient feature that serializes/de-serializes as JSON custom objects to request and from response bodies using a serializer.

The default serializer is GsonSerializer.

Note: It will de-serialize the body response if the specified type is a public accessible class and the Content-Type is application/json

Types

Config

class Config

Feature

companion object Feature : 
    HttpClientFeature<Config, JsonFeature>

Constructors

<init>

JsonFeature(serializer: JsonSerializer)

HttpClient feature that serializes/de-serializes as JSON custom objects to request and from response bodies using a serializer.

Properties

serializer

val serializer: JsonSerializer

Companion Object Properties

key

The AttributeKey for this feature.

Companion Object Functions

install

fun install(feature: JsonFeature, scope: HttpClient): Unit

Installs the feature class for a HttpClient defined at scope.

prepare

fun prepare(block: Config.() -> Unit): JsonFeature

Builds a TFeature by calling the block with a TConfig config instance as receiver.