---
title: Header
summary: Header represents the key-value pairs in a set of HTTP headers. Unlike net/http, keys are canonicalized to their lowercase form.
url: https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/fsthttp/type.Header/
---

**Kind:** Type alias  
**Module:** [fsthttp](https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/fsthttp/)  
**Package:** compute-sdk-go v1.11.0  
**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/headers.go#L11

```go
type Header map[string][]string
```

Alias for `map[string][]string`.

Header represents the key-value pairs in a set of HTTP headers. Unlike
net/http, keys are canonicalized to their lowercase form.

## Methods

### Add

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/headers.go#L21

```go
func (h Header) Add(key, value string)
```

Add adds the key, value pair to the headers. It appends to any existing
values associated with key. The key is case insensitive; it is canonicalized
by CanonicalHeaderKey.

**Parameters**

- `key`: `string`
- `value`: `string`

### Apply

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/headers.go#L86

```go
func (h Header) Apply(hs Header)
```

Apply adds all of the headers in hs. In the case of key conflict,
values from hs totally overwrite existing values in h.

**Parameters**

- `hs`: `Header`

### Clone

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/headers.go#L70

```go
func (h Header) Clone() Header
```

Clone returns a copy of the headers.

**Returns**

`Header`

### Del

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/headers.go#L28

```go
func (h Header) Del(key string)
```

Del deletes the values associated with key. The key is case insensitive; it
is canonicalized by CanonicalHeaderKey.

**Parameters**

- `key`: `string`

### Get

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/headers.go#L36

```go
func (h Header) Get(key string) string
```

Get gets the first value associated with the given key. It is case
insensitive; CanonicalHeaderKey is used to canonicalize the provided key. If
there are no values associated with the key, Get returns "".

**Parameters**

- `key`: `string`

**Returns**

`string`

### Keys

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/headers.go#L53

```go
func (h Header) Keys() []string
```

Keys returns all keys in the header collection.

**Returns**

`[]string`

### Reset

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/headers.go#L77

```go
func (h Header) Reset(hs Header)
```

Reset deletes all existing headers, and adds all of the headers in hs.

**Parameters**

- `hs`: `Header`

### Set

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/headers.go#L47

```go
func (h Header) Set(key, value string)
```

Set sets the header entries associated with key to the single element value.
It replaces any existing values associated with key. The key is case
insensitive; it is canonicalized by CanonicalHeaderKey.

**Parameters**

- `key`: `string`
- `value`: `string`

### Values

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/headers.go#L64

```go
func (h Header) Values(key string) []string
```

Values returns all values associated with the given key. It is case
insensitive; CanonicalHeaderKey is used to canonicalize the provided key. The
returned slice is not a copy.

**Parameters**

- `key`: `string`

**Returns**

`[]string`
