Headers

open class Headers(init: ReadonlyArray<Tuple2<JsString, JsString>> = definedExternally) : MapLike<JsString, JsString> (source)

The Headers interface of the Fetch API allows you to perform various actions on HTTP request and response headers.

MDN Reference

Constructors

Link copied to clipboard
constructor(init: ReadonlyRecord<JsString, JsString>)
constructor(init: Headers)
constructor(init: ReadonlyArray<Tuple2<JsString, JsString>> = definedExternally)

Functions

Link copied to clipboard
fun append(name: String, value: String)

The append() method of the Headers interface appends a new value onto an existing header inside a Headers object, or adds the header if it does not already exist.

Link copied to clipboard
fun delete(name: String)

The delete() method of the Headers interface deletes a header from the current Headers object.

Link copied to clipboard
open override fun entries(): JsIterator<Tuple2<JsString, JsString>>
Link copied to clipboard
open override fun forEach(action: (value: JsString, key: JsString) -> Unit)
Link copied to clipboard
open operator fun get(key: Symbol.iterator): () -> JsIterator<Tuple2<JsString, JsString>>

fun get(name: String): String?

The get() method of the Headers interface returns a byte string of all the values of a header within a Headers object with a given name.

Link copied to clipboard

The getSetCookie() method of the Headers interface returns an array containing the values of all Set-Cookie headers associated with a response.

Link copied to clipboard
fun has(name: String): Boolean

The has() method of the Headers interface returns a boolean stating whether a Headers object contains a certain header.

Link copied to clipboard
open inline operator fun iterator(): Iterator<Tuple2<JsString, JsString>>
Link copied to clipboard
open override fun keys(): JsIterator<JsString>
Link copied to clipboard
fun set(name: String, value: String)

The set() method of the Headers interface sets a new value for an existing header inside a Headers object, or adds the header if it does not already exist.

Link copied to clipboard
open override fun values(): JsIterator<JsString>