---
title: CanonicalHeaderKey
summary: CanonicalHeaderKey returns the canonical format of the header key s. The canonicalization converts the first letter and any letter following a hyphen to upper case; the rest are converted to lowercase. For example, the canonical key for "accept-encoding" is "Accept-Encoding". If s contains a space or invalid header field bytes, it is returned without modifications.
url: https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/fsthttp/fn.CanonicalHeaderKey/
---

**Kind:** Function  
**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#L100

```go
func CanonicalHeaderKey(s string) string
```

CanonicalHeaderKey returns the canonical format of the header key s. The
canonicalization converts the first letter and any letter following a hyphen
to upper case; the rest are converted to lowercase. For example, the
canonical key for "accept-encoding" is "Accept-Encoding". If s contains a
space or invalid header field bytes, it is returned without modifications.

**Parameters**

- `s`: `string`

**Returns**

`string`
