okhttp / okhttp3 / Headers / Builder

Builder

class Builder

Constructors

<init>

Builder()

Functions

add

fun add(line: String): Headers.Builder

Add an header line containing a field name, a literal colon, and a value.

fun add(name: String, value: String): Headers.Builder

Add a header with the specified name and value. Does validation of header names and values.

fun add(name: String, value: Date): Headers.Builder

Add a header with the specified name and formatted date. Does validation of header names and value.

fun add(name: String, value: Instant): Headers.Builder

Add a header with the specified name and formatted instant. Does validation of header names and value.

addAll

fun addAll(headers: Headers): Headers.Builder

Adds all headers from an existing collection.

addUnsafeNonAscii

fun addUnsafeNonAscii(name: String, value: String): Headers.Builder

Add a header with the specified name and value. Does validation of header names, allowing non-ASCII values.

build

fun build(): Headers

get

operator fun get(name: String): String?

Equivalent to build().get(name), but potentially faster.

removeAll

fun removeAll(name: String): Headers.Builder

set

operator fun set(name: String, value: Date): Headers.Builder

Set a field with the specified date. If the field is not found, it is added. If the field is found, the existing values are replaced.

operator fun set(name: String, value: Instant): Headers.Builder

Set a field with the specified instant. If the field is not found, it is added. If the field is found, the existing values are replaced.

operator fun set(name: String, value: String): Headers.Builder

Set a field with the specified value. If the field is not found, it is added. If the field is found, the existing values are replaced.