# CustomHeader

Artifact: [androidx.webkit:webkit](https://developer.android.com/jetpack/androidx/releases/webkit) [View Source](https://cs.android.com/search?q=file:androidx/webkit/CustomHeader.java+class:androidx.webkit.CustomHeader) Added in [1.15.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.15.0)

*** ** * ** ***


```
class CustomHeader
```

<br />

*** ** * ** ***

An HTTP header name-value pair that will be sent on requests to origins that match the given origin rules.

For document-initiated requests, custom headers take effect on document load. See `https://developer.android.com/reference/kotlin/androidx/webkit/Profile#addCustomHeader(androidx.webkit.CustomHeader)` for details.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/Profile#addCustomHeader(androidx.webkit.CustomHeader)` |   |
| `https://developer.android.com/reference/kotlin/androidx/webkit/Profile#getCustomHeaders()` |   |

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/CustomHeader#CustomHeader(java.lang.String,java.lang.String,java.util.Set<java.lang.String>)( name: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, originRules: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-set/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!> )` Create a new custom header for the given name and value, to be added to requests that match the given origin originRules |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/webkit/CustomHeader#equals(java.lang.Object)(obj: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` Two instances of `https://developer.android.com/reference/kotlin/androidx/webkit/CustomHeader` are equal if the header name and value, and rule set are equal. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/webkit/CustomHeader#getName()()` HTTP Header name |
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-set/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>` | `https://developer.android.com/reference/kotlin/androidx/webkit/CustomHeader#getRules()()` Origin patterns where this header is being sent. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/webkit/CustomHeader#getValue()()` HTTP Header value |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/webkit/CustomHeader#hashCode()()` HashCode for `https://developer.android.com/reference/kotlin/androidx/webkit/CustomHeader` is derived from the individual fields.- |

## Public constructors

### CustomHeader

Added in [1.15.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.15.0)

```
CustomHeader(
    name: String,
    value: String,
    originRules: (Mutable)Set<String!>
)
```

Create a new custom header for the given name and value, to be added to requests that match the given origin originRules

| Parameters |
|---|---|
| `name: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | A [valid HTTP header name string](https://datatracker.ietf.org/doc/html/rfc7230#section-3.2) |
| `value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | A [valid HTTP value name string](https://datatracker.ietf.org/doc/html/rfc7230#section-3.2) |
| `originRules: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-set/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>` | a set of origin originRules following the same format as `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewCompat#addWebMessageListener(android.webkit.WebView,java.lang.String,java.util.Set<java.lang.String>,androidx.webkit.WebViewCompat.WebMessageListener)` |

## Public functions

### equals

```
fun equals(obj: Any?): Boolean
```

Two instances of `https://developer.android.com/reference/kotlin/androidx/webkit/CustomHeader` are equal if the header name and value, and rule set are equal.

### getName

Added in [1.15.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.15.0)

```
fun getName(): String
```

HTTP Header name

### getRules

Added in [1.15.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.15.0)

```
fun getRules(): (Mutable)Set<String!>
```

Origin patterns where this header is being sent.

The rules use the format described in the documentation for `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewCompat#addWebMessageListener(android.webkit.WebView,java.lang.String,java.util.Set<java.lang.String>,androidx.webkit.WebViewCompat.WebMessageListener)`.

### getValue

Added in [1.15.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.15.0)

```
fun getValue(): String
```

HTTP Header value

### hashCode

```
fun hashCode(): Int
```

HashCode for `https://developer.android.com/reference/kotlin/androidx/webkit/CustomHeader` is derived from the individual fields.-