Builder

Collects entries for an HttpHeaders. Not thread-safe; use it only inside the factory's lambda.

Stable Core. Each adding call checks, in this order, that the name is not empty, that the name is an RFC 9110 token and that the value obeys the container rule; a failing call throws and changes nothing. A name is echoed in a message only after it passed the token rule; a value never.

Functions

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

Appends an entry.

Link copied to clipboard
fun addAll(headers: HttpHeaders)

Appends every entry of headers, with its sensitivity flag.

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

Appends an entry marked sensitive: it is never printed; an Untrusted outbound-URL policy refuses a request that carries it, and the transport's redirect policy strips it on a cross-origin hop.

Link copied to clipboard
fun remove(name: String)

Removes every entry named name; a no-op when there is none.

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

Replaces every entry named name with one entry appended at the end, spelled as name and flagged sensitive if any removed entry was.

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

Replaces every entry named name with one sensitive entry appended at the end.