Headers

A collection of HTTP header values.

In a majority of cases, HTTP headers are normally a collection of simple key/value pairs, but per official spec, a header field can technically contain multiple values. As a result, users are able to append new values, besides simply set them.

Also, according to the RFC, header field names are case-insensitive. In other words, accessing "Content-Type" is functionally identical to "content-type".

See also

Inheritors

Types

Link copied to clipboard
data class Entry(val name: String, val value: List<String>)

A single entry of key/value pairs, useful for iteration.

Properties

Link copied to clipboard
abstract val names: Set<String>

Functions

Link copied to clipboard
abstract fun contains(name: String): Boolean
Link copied to clipboard
abstract operator fun get(key: String): String?

Gets first value from the list of values associated with the given name, or null if the name is not present

Link copied to clipboard
abstract operator fun iterator(): Iterator<Headers.Entry>
Link copied to clipboard
abstract fun values(name: String): List<String>

Gets all entries associated with the given name