Skip to content

Latest commit

 

History

History
77 lines (54 loc) · 1.54 KB

README.md

File metadata and controls

77 lines (54 loc) · 1.54 KB

canonicalheader

CI tag Go Report Card License

Golang linter for check canonical header.

Install

go install -v github.com/lasiar/canonicalheader/cmd/canonicalheader@latest 

Or download the binary file from the release.

Example

before

package main

import (
	"net/http"
)

const testHeader = "testHeader"

func main() {
	v := http.Header{}
	v.Get(testHeader)

	v.Get("Test-HEader")
	v.Set("Test-HEader", "value")
	v.Add("Test-HEader", "value")
	v.Del("Test-HEader")
	v.Values("Test-HEader")

	v.Set("Test-Header", "value")
	v.Add("Test-Header", "value")
	v.Del("Test-Header")
	v.Values("Test-Header")
}

after

package main

import (
	"net/http"
)

const testHeader = "testHeader"

func main() {
	v := http.Header{}
	v.Get(testHeader)

	v.Get("Test-Header")
	v.Set("Test-Header", "value")
	v.Add("Test-Header", "value")
	v.Del("Test-Header")
	v.Values("Test-Header")

	v.Set("Test-Header", "value")
	v.Add("Test-Header", "value")
	v.Del("Test-Header")
	v.Values("Test-Header")
}