Golang net/http.CanonicalHeaderKey() function example

package net

Golang net/http.CanonicalHeaderKey() function usage example

 package main

 import (
 "fmt"
 "net/http"
 )

 func main() {

 str := "access-control-allow-origin"

 newStr := http.CanonicalHeaderKey(str)

 fmt.Println(newStr)

 }

Output :

Access-Control-Allow-Origin

References :

http://golang.org/pkg/net/http/#CanonicalHeaderKey

List of common headers

"accept"

"accept-charset"

"accept-encoding"

"accept-language"

"accept-ranges"

"age"

"access-control-allow-origin"

"allow"

"authorization"

"cache-control"

"content-disposition"

"content-encoding"

"content-language"

"content-length"

"content-location"

"content-range"

"content-type"

"cookie"

"date"

"etag"

"expect"

"expires"

"from"

"host"

"if-match"

"if-modified-since"

"if-none-match"

"if-unmodified-since"

"last-modified"

"link"

"location"

"max-forwards"

"proxy-authenticate"

"proxy-authorization"

"range"

"referrer"

"refresh"

"retry-after"

"server"

"set-cookie"

"strict-transport-security"

"transfer-encoding"

"user-agent"

"vary"

"via"

"www-authenticate"

Advertisement