defaultTextContentType

fun ApplicationCall.defaultTextContentType(contentType: <ERROR CLASS>?): <ERROR CLASS>

Creates a default ContentType based on the given contentType and current call.

If contentType is null, it tries to fetch an already set "Content-Type" response header. If the header is not available, text/plain is used. If contentType is specified, it uses it.

Additionally, if a charset is not set for a content type, it appends ; charset=UTF-8 to the content type.