Skip to content

//okhttp/okhttp3/Headers/Builder

Builder

[common]\ expect class Builder

[jvm, nonJvm]\ actual class Builder

Constructors

Builder [jvm, nonJvm]
fun Builder()

Functions

Name Summary
add [jvm]
fun add(line: String): Headers.Builder
Add an header line containing a field name, a literal colon, and a value.
[jvm]
@IgnoreJRERequirement
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.
[jvm]
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.
[common]
expect fun add(name: String, value: String): Headers.Builder
Add a header with the specified name and value. Does validation of header names and values.
[jvm, nonJvm]
[jvm, nonJvm]
actual fun add(name: String, value: String): Headers.Builder
addAll [common]
expect fun addAll(headers: Headers): Headers.Builder
Adds all headers from an existing collection.
[jvm, nonJvm]
[jvm, nonJvm]
actual fun addAll(headers: Headers): Headers.Builder
addUnsafeNonAscii [jvm]
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 [common, jvm, nonJvm]
[common]
expect fun build(): Headers
[jvm, nonJvm]
actual fun build(): Headers
get [common, jvm, nonJvm]
[common]
expect operator fun get(name: String): String?
[jvm, nonJvm]
actual operator fun get(name: String): String?
Equivalent to build().get(name), but potentially faster.
removeAll [common, jvm, nonJvm]
[common]
expect fun removeAll(name: String): Headers.Builder
[jvm, nonJvm]
actual fun removeAll(name: String): Headers.Builder
set [jvm]
@IgnoreJRERequirement
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.
[jvm]
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.
[common, jvm, nonJvm]
[common]
expect operator fun set(name: String, value: String): Headers.Builder
[jvm, nonJvm]
actual 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.