android-components / mozilla.components.concept.fetch / MutableHeaders

# MutableHeaders

`class MutableHeaders : Headers, MutableIterable<Header>` (source)

A collection of HTTP Headers (mutable) of a Request or Response.

### Constructors

<init> | `MutableHeaders(vararg pairs: Pair<String, String>)` A collection of HTTP Headers (mutable) of a Request or Response.

### Properties

size | `val size: Int` Returns the number of headers (key / value combinations).

### Functions

append | `fun append(name: String, value: String): MutableHeaders` Append a header without removing the headers already present.
contains | `operator fun contains(name: String): Boolean` Returns true if a Header with the given name exists.
get | `fun get(index: Int): Header` Gets the Header at the specified index. `fun get(name: String): String?` Returns the last value corresponding to the specified header field name. Or null if the header does not exist.
getAll | `fun getAll(name: String): List<String>` Returns the list of values corresponding to the specified header field name.
iterator | `fun iterator(): MutableIterator<Header>` Returns an iterator over the headers that supports removing elements during iteration.
set | `fun set(index: Int, header: Header): Unit` Sets the Header at the specified index. `fun set(name: String, value: String): MutableHeaders` Set the only occurrence of the header; potentially overriding an already existing header.