Configuration

class Configuration

Configuration type for ContentNegotiation feature

Constructors

Link copied to clipboard
fun Configuration()

Functions

Link copied to clipboard
fun accept(contributor: AcceptHeaderContributor)

Register a custom accepted content types contributor. A contributor function takes ApplicationCall and a list of content types accepted according to HttpHeaders.Accept header or provided by the previous contributor if exists. Result of this contributor should be a list of accepted content types with quality. A contributor could either keep or replace input list of accepted content types depending on use-case. For example a contributor taking format=json request parameter could replace the original content types list with the specified one from the uri argument. Note that the returned list of accepted types will be sorted according to quality using sortedByQuality so a custom contributor may keep it unsorted and should not rely on input list order.

Link copied to clipboard
fun <T : ContentConverter> register(contentType: ContentType, converter: T, configuration: T.() -> Unit = {})

Registers a contentType to a specified converter with an optional configuration script for converter

Properties

Link copied to clipboard
var checkAcceptHeaderCompliance: Boolean = false

Checks that ContentType header value of the response suits Accept header value of the request