Skip to content

Goheader is a comprehensive Go library that handles HTTP header fields. It defines constants for various standard HTTP headers such as AIM, Accept, AcceptCH, etc as well as supporting constructors.

License

Notifications You must be signed in to change notification settings

lindsaygelle/goheader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Goheader

Goheader is a Go package designed to simplify the management of HTTP headers in web applications. It offers a comprehensive collection of constants, each representing a standard HTTP header field, facilitating easy reference and usage. The package introduces a Header struct that encapsulates vital information about headers, such as name, values, and applicability, streamlining header manipulation. GoHeader provides a set of convenient functions for creating headers, allowing developers to specify multiple values efficiently. Headers are categorized based on their relevance to HTTP requests and responses, enhancing clarity in their usage context. With support for experimental headers and well-documented usage examples, GoHeader helps developers quickly integrate custom headers into their applications.

Goheader

PkgGoDev Go Report Card GitHub release (latest by date) GitHub Contributor Covenant

Features

🏷️ Comprehensive List

GoHeader provides a comprehensive list of constants for standard HTTP headers, making it easy to reference and use common headers in your applications.

đź“‚ Header Definition

Provides a Header struct that encapsulates important information about HTTP headers, including name, values, and applicability properties.

📦 Header Constructors

Offers helper functions like NewHeaders, NewAIMHeader, NewAcceptHeader, and many more, allowing developers to create headers with specified values efficiently.

Installation

You can install it in your Go project using go get:

go get github.com/lindsaygelle/goheader

Usage

Import the package into your Go code:

import (
	"github.com/lindsaygelle/goheader"
)

Functions

Provided functions for goheader.

NewAIMHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewAIMHeader("feed")
	fmt.Println(header)
}

NewAcceptHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewAcceptHeader("text/html")
	fmt.Println(header)
}

NewAcceptCHHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewAcceptCHHeader("width")
	fmt.Println(header)
}

NewAcceptCHLifetimeHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewAcceptCHLifetimeHeader("86400")
	fmt.Println(header)
}

NewAcceptCharsetHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewAcceptCharsetHeader("UTF-8")
	fmt.Println(header)
}

NewAcceptDatetimeHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewAcceptDatetimeHeader("Thu, 31 May 2007 20:35:00 GMT")
	fmt.Println(header)
}

NewAcceptEncodingHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewAcceptEncodingHeader("gzip")
	fmt.Println(header)
}

NewAcceptLanguageHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewAcceptLanguageHeader("en-AU")
	fmt.Println(header)
}

NewAcceptPatchHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewAcceptPatchHeader("application/example", "text/example")
	fmt.Println(header)
}

NewAcceptPostHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewAcceptPostHeader("application/example", "text/example")
	fmt.Println(header)
}

NewAcceptRangesHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewAcceptRangesHeader("bytes")
	fmt.Println(header)
}

NewAccessControlAllowCredentialsHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewAccessControlAllowCredentialsHeader("true")
	fmt.Println(header)
}

NewAccessControlAllowHeadersHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewAccessControlAllowHeadersHeader("*")
	fmt.Println(header)
}

NewAccessControlAllowMethodsHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewAccessControlAllowMethodsHeader("POST", "GET")
	fmt.Println(header)
}

NewAccessControlAllowOriginHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewAccessControlAllowOriginHeader("*")
	fmt.Println(header)
}

NewAccessControlExposeHeadersHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewAccessControlExposeHeadersHeader("https://github.com")
	fmt.Println(header)
}

NewAccessControlMaxAgeHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewAccessControlMaxAgeHeader("600")
	fmt.Println(header)
}

NewAccessControlRequestHeadersHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewAccessControlRequestHeadersHeader("Content-Type", "X-User-Addr")
	fmt.Println(header)
}

NewAccessControlRequestMethodHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewAccessControlRequestMethodHeader("GET")
	fmt.Println(header)
}

NewAgeHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewAgeHeader("15")
	fmt.Println(header)
}

NewAllowHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewAllowHeader("HEAD", "GET")
	fmt.Println(header)
}

NewAltSvcHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewAltSvcHeader("h2=\"alt.example.com:443\"", "h2=\":443\"")
	fmt.Println(header)
}

NewAltUsedHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewAltUsedHeader("alternate.example.net")
	fmt.Println(header)
}

NewAuthorizationHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewAuthorizationHeader("Basic RXhhbXBsZTphaQ==")
	fmt.Println(header)
}

NewCacheControlHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewCacheControlHeader("max-age=604800")
	fmt.Println(header)
}

NewClearSiteDataHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewClearSiteDataHeader("*")
	fmt.Println(header)
}

NewConnectionHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewConnectionHeader("keep-alive")
	fmt.Println(header)
}

NewContentDPRHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewContentDPRHeader("1")
	fmt.Println(header)
}

NewContentDispositionHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewContentDispositionHeader("attachment; filename=\"document.doc\"")
	fmt.Println(header)
}

NewContentEncodingHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewContentEncodingHeader("deflate", "br")
	fmt.Println(header)
}

NewContentLanguageHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewContentLanguageHeader("en-AU")
	fmt.Println(header)
}

NewContentLengthHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewContentLengthHeader("128")
	fmt.Println(header)
}

NewContentLocationHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewContentLocationHeader("https://example.com/documents/foo")
	fmt.Println(header)
}

NewContentMD5Header

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewContentMD5Header("b89f948e98f3a113dc13fdbd3bdb17ef")
	fmt.Println(header)
}

NewContentRangeHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewContentRangeHeader("1000-2000/*")
	fmt.Println(header)
}

NewContentSecurityPolicyHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewContentSecurityPolicyHeader("default-src 'self'; font-src fonts.gstatic.com; style-src 'self' fonts.googleapis.com")
	fmt.Println(header)
}

NewContentSecurityPolicyReportOnlyHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewContentSecurityPolicyReportOnlyHeader("default-src https:; report-to /csp-violation-report-endpoint/")
	fmt.Println(header)
}

NewContentTypeHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewContentTypeHeader("text/html; charset=utf-8")
	fmt.Println(header)
}

NewCookieHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewCookieHeader("PHPSESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1")
	fmt.Println(header)
}

NewCorrelationIDHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewCorrelationIDHeader("93dba609-c615-4513-b95b-0d3468ec20d0")
	fmt.Println(header)
}

NewCriticalCHHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewCriticalCHHeader("Sec-CH-Prefers-Reduced-Motion")
	fmt.Println(header)
}

NewCrossOriginEmbedderPolicyHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewCrossOriginEmbedderPolicyHeader("require-corp")
	fmt.Println(header)
}

NewCrossOriginOpenerPolicyHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewCrossOriginOpenerPolicyHeader("same-origin-allow-popups")
	fmt.Println(header)
}

NewCrossOriginResourcePolicyHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewCrossOriginResourcePolicyHeader("same-origin")
	fmt.Println(header)
}

NewDNTHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewDNTHeader("1")
	fmt.Println(header)
}

NewDPRHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewDPRHeader("2.0")
	fmt.Println(header)
}

NewDateHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewDateHeader("Wed, 21 Oct 2015 07:28:00 GMT")
	fmt.Println(header)
}

NewDeltaBaseHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewDeltaBaseHeader("12340001")
	fmt.Println(header)
}

NewDeviceMemoryHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewDeviceMemoryHeader("2")
	fmt.Println(header)
}

NewDigestHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewDigestHeader("sha-512= 3b761a2a9a96e1c430236dc31378a3450ea189ae1449c3c8eac25cfa8b25381661317968a54cf46bfced09ae6b49f8512832182ac2d087b22380fcb760d802a3")
	fmt.Println(header)
}

NewDownlinkHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewDownlinkHeader("1.7")
	fmt.Println(header)
}

NewECTHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewECTHeader("2g")
	fmt.Println(header)
}

NewETagHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewETagHeader("33a64df551425fcc55e4d42a148795d9f25f89d4")
	fmt.Println(header)
}

NewEarlyDataHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewEarlyDataHeader("1")
	fmt.Println(header)
}

NewExpectHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewExpectHeader("100-continue")
	fmt.Println(header)
}

NewExpectCTHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewExpectCTHeader("max-age=86400", "enforce", "report-uri=\"https://foo.example.com/report\"")
	fmt.Println(header)
}

NewExpiresHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewExpiresHeader("Wed, 21 Oct 2015 07:28:00 GMT")
	fmt.Println(header)
}

NewForwardedHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewForwardedHeader("for=192.0.2.43", "for=198.51.100.17")
	fmt.Println(header)
}

NewFromHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewFromHeader("webmaster@example.org")
	fmt.Println(header)
}

NewFrontEndHTTPSHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewFrontEndHTTPSHeader("on")
	fmt.Println(header)
}

NewHTTP2SettingsHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewHTTP2SettingsHeader("token64")
	fmt.Println(header)
}

NewHostHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewHostHeader("Host")
	fmt.Println(header)
}

NewIMHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewIMHeader("feed")
	fmt.Println(header)
}

NewIfMatchHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewIfMatchHeader("737060cd8c284d8af7ad3082f209582d")
	fmt.Println(header)
}

NewIfModifiedSinceHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewIfModifiedSinceHeader("Sat, 29 Oct 1994 19:43:31 GMT")
	fmt.Println(header)
}

NewIfNoneMatchHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewIfNoneMatchHeader("737060cd8c284d8af7ad3082f209582d")
	fmt.Println(header)
}

NewIfRangeHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewIfRangeHeader("737060cd8c284d8af7ad3082f209582d")
	fmt.Println(header)
}

NewIfUnmodifiedSinceHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewIfUnmodifiedSinceHeader("Sat, 29 Oct 1994 19:43:31 GMT")
	fmt.Println(header)
}

NewKeepAliveHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewKeepAliveHeader("timeout=5", "max=1000")
	fmt.Println(header)
}

NewLargeAllocationHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewLargeAllocationHeader("500")
	fmt.Println(header)
}

NewLastModifiedHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewLastModifiedHeader("Wed, 21 Oct 2015 07:28:00 GMT")
	fmt.Println(header)
}

NewLinkHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewLinkHeader("<https://one.example.com>; rel=\"preconnect\"", "<https://two.example.com>; rel=\"preconnect\"", "<https://three.example.com>; rel=\"preconnect\"")
	fmt.Println(header)
}

NewLocationHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewLocationHeader("/index.html")
	fmt.Println(header)
}

NewMaxForwardsHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewMaxForwardsHeader("10")
	fmt.Println(header)
}

NewNELHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewNELHeader("{ \"report_to\": \"name_of_reporting_group\", \"max_age\": 12345, \"include_subdomains\": false, \"success_fraction\": 0.0, \"failure_fraction\": 1.0 }")
	fmt.Println(header)
}

NewOriginHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewOriginHeader("https://example.com")
	fmt.Println(header)
}

NewP3PHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewP3PHeader("CP=\"https://example.com/P3P\"")
	fmt.Println(header)
}

NewPermissionsPolicyHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewPermissionsPolicyHeader("(\"https://example.com\" \"https://a.example.com\" \"https://b.example.com\" \"https://c.example.com\")")
	fmt.Println(header)
}

NewPragmaHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewPragmaHeader("no-cache")
	fmt.Println(header)
}

NewPreferHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewPreferHeader("respond-async", "wait=5")
	fmt.Println(header)
}

NewPreferenceAppliedHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewPreferenceAppliedHeader("return=representation")
	fmt.Println(header)
}

NewProxyAuthenticateHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewProxyAuthenticateHeader("Basic realm=\"Access to the internal site\"")
	fmt.Println(header)
}

NewProxyAuthorizationHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewProxyAuthorizationHeader("Basic YWxhZGRpbjpvcGVuc2VzYW1l")
	fmt.Println(header)
}

NewProxyConnectionHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewProxyConnectionHeader("keep-alive")
	fmt.Println(header)
}

NewPublicKeyPinsHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewPublicKeyPinsHeader("max-age=2592000; pin-sha256=\"E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g=\";")
	fmt.Println(header)
}

NewRTTHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewRTTHeader("123")
	fmt.Println(header)
}

NewRangeHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewRangeHeader("bytes=200-1000", "2000-6576", "19000-")
	fmt.Println(header)
}

NewRefererHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewRefererHeader("https://example.com/")
	fmt.Println(header)
}

NewReferrerPolicyHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewReferrerPolicyHeader("no-referrer", "strict-origin-when-cross-origin")
	fmt.Println(header)
}

NewRefreshHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewRefreshHeader("5; url=http://www.w3.org/pub/WWW/People.html")
	fmt.Println(header)
}

NewReportToHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewReportToHeader("{ \"group\": \"csp-endpoint\", \"max_age\": 10886400, \"endpoints\": [ { \"url\": \"https-url-of-site-which-collects-reports\" } ] }")
	fmt.Println(header)
}

NewRetryAfterHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewRetryAfterHeader("123")
	fmt.Println(header)
}

NewSaveDataHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewSaveDataHeader("on")
	fmt.Println(header)
}

NewSecCHPrefersColorSchemeHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewSecCHPrefersColorSchemeHeader("dark")
	fmt.Println(header)
}

NewSecCHPrefersReducedMotionHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewSecCHPrefersReducedMotionHeader("reduce")
	fmt.Println(header)
}

NewSecCHPrefersReducedTransparencyHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewSecCHPrefersReducedTransparencyHeader("reduce")
	fmt.Println(header)
}

NewSecCHUAHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewSecCHUAHeader("\"Opera\";v=\"81\", \" Not;A Brand\";v=\"99\", \"Chromium\";v=\"95\"")
	fmt.Println(header)
}

NewSecCHUAArchHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewSecCHUAArchHeader("x86")
	fmt.Println(header)
}

NewSecCHUABitnessHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewSecCHUABitnessHeader("64")
	fmt.Println(header)
}

NewSecCHUAFullVersionHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewSecCHUAFullVersionHeader("96.0.4664.110")
	fmt.Println(header)
}

NewSecCHUAFullVersionListHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewSecCHUAFullVersionListHeader("\" Not A;Brand\";v=\"99.0.0.0\", \"Chromium\";v=\"98.0.4750.0\", \"Google Chrome\";v=\"98.0.4750.0\"")
	fmt.Println(header)
}

NewSecCHUAMobileHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewSecCHUAMobileHeader("?1")
	fmt.Println(header)
}

NewSecCHUAModelHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewSecCHUAModelHeader("Pixel 3 XL")
	fmt.Println(header)
}

NewSecCHUAPlatformHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewSecCHUAPlatformHeader("macOS")
	fmt.Println(header)
}

NewSecCHUAPlatformVersionHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewSecCHUAPlatformVersionHeader("10.0.0")
	fmt.Println(header)
}

NewSecFetchDestHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewSecFetchDestHeader("image")
	fmt.Println(header)
}

NewSecFetchModeHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewSecFetchModeHeader("no-cors")
	fmt.Println(header)
}

NewSecFetchSiteHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewSecFetchSiteHeader("cross-site")
	fmt.Println(header)
}

NewSecFetchUserHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewSecFetchUserHeader("?1")
	fmt.Println(header)
}

NewSecGPCHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewSecGPCHeader("1")
	fmt.Println(header)
}

NewSecPurposeHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewSecPurposeHeader("prefetch")
	fmt.Println(header)
}

NewSecWebSocketAcceptHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewSecWebSocketAcceptHeader("s3pPLMBiTxaQ9kYGzzhZRbK+xOo=")
	fmt.Println(header)
}

NewServerHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewServerHeader("Apache/2.4.1 (Unix)")
	fmt.Println(header)
}

NewServerTimingHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewServerTimingHeader("missedCache")
	fmt.Println(header)
}

NewServiceWorkerNavigationPreloadHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewServiceWorkerNavigationPreloadHeader("json_fragment1")
	fmt.Println(header)
}

NewSetCookieHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewSetCookieHeader("id=a3fWa; Expires=Wed, 21 Oct 2015 07:28:00 GM")
	fmt.Println(header)
}

NewSourceMapHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewSourceMapHeader("/static/js/file.js")
	fmt.Println(header)
}

NewStatusHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewStatusHeader("200 OK")
	fmt.Println(header)
}

NewStrictTransportSecurityHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewStrictTransportSecurityHeader("max-age=63072000; includeSubDomains; preload")
	fmt.Println(header)
}

NewTEHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewTEHeader("compress, deflate;q=0.7")
	fmt.Println(header)
}

NewTimingAllowOriginHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewTimingAllowOriginHeader("https://www.example.com")
	fmt.Println(header)
}

NewTKHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewTKHeader("T")
	fmt.Println(header)
}

NewTrailerHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewTrailerHeader("Expires")
	fmt.Println(header)
}

NewTransferEncodingHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewTransferEncodingHeader("gzip", "chunked")
	fmt.Println(header)
}

NewUpgradeHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewUpgradeHeader("example/1", "example/2")
	fmt.Println(header)
}

NewUpgradeInsecureRequestsHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewUpgradeInsecureRequestsHeader("1")
	fmt.Println(header)
}

NewUserAgentHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewUserAgentHeader("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36")
	fmt.Println(header)
}

NewVaryHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewVaryHeader("Accept")
	fmt.Println(header)
}

NewViaHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewViaHeader("HTTP/1.1 proxy.example.re", "1.1 edge_1")
	fmt.Println(header)
}

NewViewportWidthHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewViewportWidthHeader("320")
	fmt.Println(header)
}

NewWWWAuthenticateHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewWWWAuthenticateHeader("Basic realm=\"Access to the staging site\", charset=\"UTF-8\"")
	fmt.Println(header)
}

NewWantDigestHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewWantDigestHeader("SHA-512;q=0.3, sha-256;q=1, md5;q=0")
	fmt.Println(header)
}

NewWarningHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewWarningHeader("112 - \"cache down\" \"Wed, 21 Oct 2015 07:28:00 GMT\"")
	fmt.Println(header)
}

NewWidthHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewWidthHeader("1920")
	fmt.Println(header)
}

NewXATTDeviceIDHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewXATTDeviceIDHeader("GT-P7320/P7320XXLPG")
	fmt.Println(header)
}

NewXContentDurationHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewXContentDurationHeader("42.666")
	fmt.Println(header)
}

NewXContentSecurityPolicyHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewXContentSecurityPolicyHeader("default-src 'self'")
	fmt.Println(header)
}

NewXContentTypeOptionsHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewXContentTypeOptionsHeader("nosniff")
	fmt.Println(header)
}

NewXCorrelationIDHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewXCorrelationIDHeader("f058ebd6-02f7-4d3f-942e-904344e8cde5")
	fmt.Println(header)
}

NewXCSRFTokenHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewXCSRFTokenHeader("i8XNjC4b8KVok4uw5RftR38Wgp2BFwql")
	fmt.Println(header)
}

NewXDNSPrefetchControlHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewXDNSPrefetchControlHeader("off")
	fmt.Println(header)
}

NewXForwardedForHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewXForwardedForHeader("203.0.113.195", "2001:db8:85a3:8d3:1319:8a2e:370:7348")
	fmt.Println(header)
}

NewXForwardedHostHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewXForwardedHostHeader("id42.example-cdn.com")
	fmt.Println(header)
}

NewXForwardedProtoHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewXForwardedProtoHeader("https")
	fmt.Println(header)
}

NewXFrameOptionsHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewXFrameOptionsHeader("SAMEORIGIN")
	fmt.Println(header)
}

NewXHTTPMethodOverrideHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewXHTTPMethodOverrideHeader("DELETE")
	fmt.Println(header)
}

NewXPoweredByHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewXPoweredByHeader("PHP/5.4.0")
	fmt.Println(header)
}

NewXRedirectByHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewXRedirectByHeader("WordPress")
	fmt.Println(header)
}

NewXRequestIDHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewXRequestIDHeader("f058ebd6-02f7-4d3f-942e-904344e8cde5")
	fmt.Println(header)
}

NewXRequestedWithHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewXRequestedWithHeader("XMLHttpRequest")
	fmt.Println(header)
}

NewXUACompatibleHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewXUACompatibleHeader("IE=EmulateIE7")
	fmt.Println(header)
}

NewXUIDHHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewXUIDHHeader("...")
	fmt.Println(header)
}

NewXWapProfileHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewXWapProfileHeader("http://wap.samsungmobile.com/uaprof/SGH-I777.xml")
	fmt.Println(header)
}

NewXWebKitCSPHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewXWebKitCSPHeader("default-src 'self'")
	fmt.Println(header)
}

NewXXSSProtectionHeader

// GitHub goheader example.
package main

// Import the goheader package.
import "github.com/lindsaygelle/goheader"

func main() {
	// Create a new HTTP header for use in HTTP client.
	header := goheader.NewXXSSProtectionHeader("1; mode=block")
	fmt.Println(header)
}

Examples

ResponseWriter

Adding new Headers to an existing http.ResponseWriter.

// GitHub goheader example.
package main

import (
	"encoding/json"
	"fmt"
	"log"
	"net/http"

	"github.com/lindsaygelle/goheader"
)

func main() {
	// Create a default handler.
	http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		// Create a new set of goheader.Header instances.
		headers := []goheader.Header{
			goheader.NewContentLanguageHeader("en-AU"),
			goheader.NewContentTypeHeader("application/json"),
			goheader.NewCookieHeader("language=golang")}

		// Add the headers to the http.ResponseWriter.
		goheader.WriteHeaders(w, headers...)
		// Write the HTTP status code.
		w.WriteHeader(http.StatusOK)
		// Write the HTTP response.
		json.NewEncoder(w).Encode(w.Header()) // { "Content-Language": [ "en-AU" ], "Content-Type": [ "application/json" ], "Cookie": [ "language=golang" ] }
	})
	// Set the port for the server.
	serverAddress := fmt.Sprintf(":%d", 8080)
	// Serve content.
	log.Println(http.ListenAndServe(serverAddress, nil))
}

Docker

A Dockerfile is provided for individuals that prefer containerized development.

Building

Building the Docker container:

docker build . -t goheader

Running

Developing and running Go within the Docker container:

docker run -it --rm --name goheader goheader

Docker Compose

A docker-compose file has also been included for convenience:

Running

Running the compose file.

docker-compose up -d

Contributing

We warmly welcome contributions to Goheader. Whether you have innovative ideas, bug reports, or enhancements in mind, please share them with us by submitting GitHub issues or creating pull requests. For substantial contributions, it's a good practice to start a discussion by creating an issue to ensure alignment with the project's goals and direction. Refer to the CONTRIBUTING file for comprehensive details.

Branching

For a smooth collaboration experience, we have established branch naming conventions and guidelines. Please consult the BRANCH_NAMING_CONVENTION document for comprehensive information and best practices.

License

Goheader is released under the MIT License, granting you the freedom to use, modify, and distribute the code within this repository in accordance with the terms of the license. For additional information, please review the LICENSE file.

Security

If you discover a security vulnerability within this project, please consult the SECURITY document for information and next steps.

Code Of Conduct

This project has adopted the Amazon Open Source Code of Conduct. For additional information, please review the CODE_OF_CONDUCT file.

Acknowledgements

Big thanks to egonelbre/gophers for providing the delightful Gopher artwork used in the social preview. Don't hesitate to pay them a visit!

References

The information for this package was sourced from the following sites.

Mozilla Developer Network The go-to resource for comprehensive HTTP header information.

Wikipedia A reliable reference providing detailed insights into various HTTP header fields.

http.dev A valuable platform offering expert guidance and best practices in HTTP development.

If you spot any discrepancies or have additional insights, don't hesitate to reach out!

About

Goheader is a comprehensive Go library that handles HTTP header fields. It defines constants for various standard HTTP headers such as AIM, Accept, AcceptCH, etc as well as supporting constructors.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages