FetchHeaders

Fetch: Headers.

Describes the interface for a Fetch API compliant structure containing HTTP headers; this includes both the header names (as keys), and the header values, including multiple values per header, as applicable. Effectively, the fetch headers object acts as a container (as a JsMultiMap, specifically of all strings).

 

Mutability

Headers can be expressed in mutable or immutable form. For example, when headers are used as inputs for a request (meaning the values originate from another machine), they are expressed in immutable form. To mutate such headers, the developer can simply construct a mutable copy using one of the constructors available via FetchHeaders.Factory.

 

Rendering headers

Multiple header values, by spec, can often be reduced to comma-separated values within the same header name. Child implementations are expected to provide a render function which performs this task from held values.

Inheritors

Types

Link copied to clipboard

Factory for default-implementation instances of FetchHeaders.

Link copied to clipboard

Specifies constructors which are expected to be made available for a given FetchHeaders implementation. These constructors include JavaScript-spec constructors as well as regular host-side wrap or create constructors. In all cases, these constructors are expected to return a copy of the provided data, as applicable.

Properties

Link copied to clipboard
abstract val entries: Set<Map.Entry<String, String>>
Link copied to clipboard
abstract val keys: Set<String>
Link copied to clipboard
abstract val size: Int
Link copied to clipboard
abstract val values: Collection<String>

Functions

Link copied to clipboard
abstract fun containsKey(key: String): Boolean
Link copied to clipboard
abstract fun containsValue(value: String): Boolean
Link copied to clipboard
Link copied to clipboard
abstract fun forEach(op: (MapLike.Entry<String, String>) -> Unit)

TBD.

Link copied to clipboard
abstract operator override fun get(key: String): String?

TBD.

Link copied to clipboard
abstract fun getAll(key: String): List<String>

TBD.

Link copied to clipboard
abstract fun has(key: String): Boolean

TBD.

Link copied to clipboard
abstract fun isEmpty(): Boolean
Link copied to clipboard
abstract fun keys(): JsIterator<String>

TBD.

Link copied to clipboard
abstract fun render(flatten: Boolean = true): Map<String, List<String>>

Render these fetch headers into a raw map where the keys are normalized HTTP header names, and the values are either rendered into a single comma-separated string, or expressed literally, depending on the value of flatten.

Link copied to clipboard
abstract override fun toString(): String

TBD.

Link copied to clipboard
abstract fun values(): JsIterator<String>

TBD.