Documentation ΒΆ
Overview ΒΆ
Package goheader provides helper functions and predefined header names for creating both standard and custom HTTP headers in Golang applications. It simplifies the process of managing headers, ensuring compatibility and ease of use in various HTTP-related tasks.
Index ΒΆ
- Constants
- func NewHeaders(headers ...*Header) http.Header
- func WriteHeaders(writer interface{ ... }, headers ...Header)
- type Header
- func NewAIMHeader(values ...string) Header
- func NewAcceptCHHeader(values ...string) Header
- func NewAcceptCHLifetimeHeader(values ...string) Header
- func NewAcceptCharsetHeader(values ...string) Header
- func NewAcceptDatetimeHeader(values ...string) Header
- func NewAcceptEncodingHeader(values ...string) Header
- func NewAcceptHeader(values ...string) Header
- func NewAcceptLanguageHeader(values ...string) Header
- func NewAcceptPatchHeader(values ...string) Header
- func NewAcceptPostHeader(values ...string) Header
- func NewAcceptRangesHeader(values ...string) Header
- func NewAccessControlAllowCredentialsHeader(values ...string) Header
- func NewAccessControlAllowHeadersHeader(values ...string) Header
- func NewAccessControlAllowMethodsHeader(values ...string) Header
- func NewAccessControlAllowOriginHeader(values ...string) Header
- func NewAccessControlExposeHeadersHeader(values ...string) Header
- func NewAccessControlMaxAgeHeader(values ...string) Header
- func NewAccessControlRequestHeadersHeader(values ...string) Header
- func NewAccessControlRequestMethodHeader(values ...string) Header
- func NewAgeHeader(values ...string) Header
- func NewAllowHeader(values ...string) Header
- func NewAltSvcHeader(values ...string) Header
- func NewAltUsedHeader(values ...string) Header
- func NewAuthorizationHeader(values ...string) Header
- func NewCacheControlHeader(values ...string) Header
- func NewClearSiteDataHeader(values ...string) Header
- func NewConnectionHeader(values ...string) Header
- func NewContentDPRHeader(values ...string) Header
- func NewContentDispositionHeader(values ...string) Header
- func NewContentEncodingHeader(values ...string) Header
- func NewContentLanguageHeader(values ...string) Header
- func NewContentLengthHeader(values ...string) Header
- func NewContentLocationHeader(values ...string) Header
- func NewContentMD5Header(values ...string) Header
- func NewContentRangeHeader(values ...string) Header
- func NewContentSecurityPolicyHeader(values ...string) Header
- func NewContentSecurityPolicyReportOnlyHeader(values ...string) Header
- func NewContentTypeHeader(values ...string) Header
- func NewCookieHeader(values ...string) Header
- func NewCorrelationIDHeader(values ...string) Header
- func NewCriticalCHHeader(values ...string) Header
- func NewCrossOriginEmbedderPolicyHeader(values ...string) Header
- func NewCrossOriginOpenerPolicyHeader(values ...string) Header
- func NewCrossOriginResourcePolicyHeader(values ...string) Header
- func NewDNTHeader(values ...string) Header
- func NewDPRHeader(values ...string) Header
- func NewDateHeader(values ...string) Header
- func NewDeltaBaseHeader(values ...string) Header
- func NewDeviceMemoryHeader(values ...string) Header
- func NewDigestHeader(values ...string) Header
- func NewDownlinkHeader(values ...string) Header
- func NewECTHeader(values ...string) Header
- func NewETagHeader(values ...string) Header
- func NewEarlyDataHeader(values ...string) Header
- func NewExpectCTHeader(values ...string) Header
- func NewExpectHeader(values ...string) Header
- func NewExpiresHeader(values ...string) Header
- func NewForwardedHeader(values ...string) Header
- func NewFromHeader(values ...string) Header
- func NewFrontEndHTTPSHeader(values ...string) Header
- func NewHTTP2SettingsHeader(values ...string) Header
- func NewHostHeader(values ...string) Header
- func NewIMHeader(values ...string) Header
- func NewIfMatchHeader(values ...string) Header
- func NewIfModifiedSinceHeader(values ...string) Header
- func NewIfNoneMatchHeader(values ...string) Header
- func NewIfRangeHeader(values ...string) Header
- func NewIfUnmodifiedSinceHeader(values ...string) Header
- func NewKeepAliveHeader(values ...string) Header
- func NewLargeAllocationHeader(values ...string) Header
- func NewLastModifiedHeader(values ...string) Header
- func NewLinkHeader(values ...string) Header
- func NewLocationHeader(values ...string) Header
- func NewMaxForwardsHeader(values ...string) Header
- func NewNELHeader(values ...string) Header
- func NewOriginHeader(values ...string) Header
- func NewP3PHeader(values ...string) Header
- func NewPermissionsPolicyHeader(values ...string) Header
- func NewPragmaHeader(values ...string) Header
- func NewPreferHeader(values ...string) Header
- func NewPreferenceAppliedHeader(values ...string) Header
- func NewProxyAuthenticateHeader(values ...string) Header
- func NewProxyAuthorizationHeader(values ...string) Header
- func NewProxyConnectionHeader(values ...string) Header
- func NewPublicKeyPinsHeader(values ...string) Header
- func NewRTTHeader(values ...string) Header
- func NewRangeHeader(values ...string) Header
- func NewRefererHeader(values ...string) Header
- func NewReferrerPolicyHeader(values ...string) Header
- func NewRefreshHeader(values ...string) Header
- func NewReportToHeader(values ...string) Header
- func NewRetryAfterHeader(values ...string) Header
- func NewSaveDataHeader(values ...string) Header
- func NewSecCHPrefersColorSchemeHeader(values ...string) Header
- func NewSecCHPrefersReducedMotionHeader(values ...string) Header
- func NewSecCHPrefersReducedTransparencyHeader(values ...string) Header
- func NewSecCHUAArchHeader(values ...string) Header
- func NewSecCHUABitnessHeader(values ...string) Header
- func NewSecCHUAFullVersionHeader(values ...string) Header
- func NewSecCHUAFullVersionListHeader(values ...string) Header
- func NewSecCHUAHeader(values ...string) Header
- func NewSecCHUAMobileHeader(values ...string) Header
- func NewSecCHUAModelHeader(values ...string) Header
- func NewSecCHUAPlatformHeader(values ...string) Header
- func NewSecCHUAPlatformVersionHeader(values ...string) Header
- func NewSecFetchDestHeader(values ...string) Header
- func NewSecFetchModeHeader(values ...string) Header
- func NewSecFetchSiteHeader(values ...string) Header
- func NewSecFetchUserHeader(values ...string) Header
- func NewSecGPCHeader(values ...string) Header
- func NewSecPurposeHeader(values ...string) Header
- func NewSecWebSocketAcceptHeader(values ...string) Header
- func NewServerHeader(values ...string) Header
- func NewServerTimingHeader(values ...string) Header
- func NewServiceWorkerNavigationPreloadHeader(values ...string) Header
- func NewSetCookieHeader(values ...string) Header
- func NewSourceMapHeader(values ...string) Header
- func NewStatusHeader(values ...string) Header
- func NewStrictTransportSecurityHeader(values ...string) Header
- func NewSupportsLoadingModeHeader(values ...string) Header
- func NewTEHeader(values ...string) Header
- func NewTKHeader(values ...string) Header
- func NewTimingAllowOriginHeader(values ...string) Header
- func NewTrailerHeader(values ...string) Header
- func NewTransferEncodingHeader(values ...string) Header
- func NewUpgradeHeader(values ...string) Header
- func NewUpgradeInsecureRequestsHeader(values ...string) Header
- func NewUserAgentHeader(values ...string) Header
- func NewVaryHeader(values ...string) Header
- func NewViaHeader(values ...string) Header
- func NewViewportWidthHeader(values ...string) Header
- func NewWWWAuthenticateHeader(values ...string) Header
- func NewWantDigestHeader(values ...string) Header
- func NewWarningHeader(values ...string) Header
- func NewWidthHeader(values ...string) Header
- func NewXATTDeviceIDHeader(values ...string) Header
- func NewXCSRFTokenHeader(values ...string) Header
- func NewXContentDurationHeader(values ...string) Header
- func NewXContentSecurityPolicyHeader(values ...string) Header
- func NewXContentTypeOptionsHeader(values ...string) Header
- func NewXCorrelationIDHeader(values ...string) Header
- func NewXDNSPrefetchControlHeader(values ...string) Header
- func NewXForwardedForHeader(values ...string) Header
- func NewXForwardedHostHeader(values ...string) Header
- func NewXForwardedProtoHeader(values ...string) Header
- func NewXFrameOptionsHeader(values ...string) Header
- func NewXHTTPMethodOverrideHeader(values ...string) Header
- func NewXPoweredByHeader(values ...string) Header
- func NewXRedirectByHeader(values ...string) Header
- func NewXRequestIDHeader(values ...string) Header
- func NewXRequestedWithHeader(values ...string) Header
- func NewXUACompatibleHeader(values ...string) Header
- func NewXUIDHHeader(values ...string) Header
- func NewXWapProfileHeader(values ...string) Header
- func NewXWebKitCSPHeader(values ...string) Header
- func NewXXSSProtectionHeader(values ...string) Header
Examples ΒΆ
- NewAIMHeader
- NewAcceptCHHeader
- NewAcceptCHLifetimeHeader
- NewAcceptCharsetHeader
- NewAcceptDatetimeHeader
- NewAcceptEncodingHeader
- NewAcceptHeader
- NewAcceptLanguageHeader
- NewAcceptPatchHeader
- NewAcceptPostHeader
- NewAcceptRangesHeader
- NewAccessControlAllowCredentialsHeader
- NewAccessControlAllowHeadersHeader
- NewAccessControlAllowMethodsHeader
- NewAccessControlAllowOriginHeader
- NewAccessControlExposeHeadersHeader
- NewAccessControlMaxAgeHeader
- NewAccessControlRequestHeadersHeader
- NewAccessControlRequestMethodHeader
- NewAgeHeader
- NewAllowHeader
- NewAltSvcHeader
- NewAltUsedHeader
- NewAuthorizationHeader
- NewCacheControlHeader
- NewClearSiteDataHeader
- NewConnectionHeader
- NewContentDPRHeader
- NewContentDispositionHeader
- NewContentEncodingHeader
- NewContentLanguageHeader
- NewContentLengthHeader
- NewContentLocationHeader
- NewContentMD5Header
- NewContentRangeHeader
- NewContentSecurityPolicyHeader
- NewContentSecurityPolicyReportOnlyHeader
- NewContentTypeHeader
- NewCookieHeader
- NewCorrelationIDHeader
- NewCriticalCHHeader
- NewCrossOriginEmbedderPolicyHeader
- NewCrossOriginOpenerPolicyHeader
- NewCrossOriginResourcePolicyHeader
- NewDNTHeader
- NewDPRHeader
- NewDateHeader
- NewDeltaBaseHeader
- NewDeviceMemoryHeader
- NewDigestHeader
- NewDownlinkHeader
- NewECTHeader
- NewETagHeader
- NewEarlyDataHeader
- NewExpectCTHeader
- NewExpectHeader
- NewExpiresHeader
- NewForwardedHeader
- NewFromHeader
- NewFrontEndHTTPSHeader
- NewHTTP2SettingsHeader
- NewHostHeader
- NewIMHeader
- NewIfMatchHeader
- NewIfModifiedSinceHeader
- NewIfNoneMatchHeader
- NewIfRangeHeader
- NewIfUnmodifiedSinceHeader
- NewKeepAliveHeader
- NewLargeAllocationHeader
- NewLastModifiedHeader
- NewLinkHeader
- NewLocationHeader
- NewMaxForwardsHeader
- NewNELHeader
- NewOriginHeader
- NewP3PHeader
- NewPermissionsPolicyHeader
- NewPragmaHeader
- NewPreferHeader
- NewPreferenceAppliedHeader
- NewProxyAuthenticateHeader
- NewProxyAuthorizationHeader
- NewProxyConnectionHeader
- NewPublicKeyPinsHeader
- NewRTTHeader
- NewRangeHeader
- NewRefererHeader
- NewReferrerPolicyHeader
- NewRefreshHeader
- NewReportToHeader
- NewRetryAfterHeader
- NewSaveDataHeader
- NewSecCHPrefersColorSchemeHeader
- NewSecCHPrefersReducedMotionHeader
- NewSecCHPrefersReducedTransparencyHeader
- NewSecCHUAArchHeader
- NewSecCHUABitnessHeader
- NewSecCHUAFullVersionHeader
- NewSecCHUAFullVersionListHeader
- NewSecCHUAHeader
- NewSecCHUAMobileHeader
- NewSecCHUAModelHeader
- NewSecCHUAPlatformHeader
- NewSecCHUAPlatformVersionHeader
- NewSecFetchDestHeader
- NewSecFetchModeHeader
- NewSecFetchSiteHeader
- NewSecFetchUserHeader
- NewSecGPCHeader
- NewSecPurposeHeader
- NewSecWebSocketAcceptHeader
- NewServerHeader
- NewServerTimingHeader
- NewServiceWorkerNavigationPreloadHeader
- NewSetCookieHeader
- NewSourceMapHeader
- NewStatusHeader
- NewStrictTransportSecurityHeader
- NewTEHeader
- NewTKHeader
- NewTimingAllowOriginHeader
- NewTrailerHeader
- NewTransferEncodingHeader
- NewUpgradeHeader
- NewUpgradeInsecureRequestsHeader
- NewUserAgentHeader
- NewVaryHeader
- NewViaHeader
- NewViewportWidthHeader
- NewWWWAuthenticateHeader
- NewWantDigestHeader
- NewWarningHeader
- NewWidthHeader
- NewXATTDeviceIDHeader
- NewXCSRFTokenHeader
- NewXContentDurationHeader
- NewXContentSecurityPolicyHeader
- NewXContentTypeOptionsHeader
- NewXCorrelationIDHeader
- NewXDNSPrefetchControlHeader
- NewXForwardedForHeader
- NewXForwardedHostHeader
- NewXForwardedProtoHeader
- NewXFrameOptionsHeader
- NewXHTTPMethodOverrideHeader
- NewXPoweredByHeader
- NewXRedirectByHeader
- NewXRequestIDHeader
- NewXRequestedWithHeader
- NewXUACompatibleHeader
- NewXUIDHHeader
- NewXWapProfileHeader
- NewXWebKitCSPHeader
- NewXXSSProtectionHeader
- WriteHeaders
Constants ΒΆ
const AIM = "A-IM"
AIM header field is used to indicate acceptable instance-manipulations for the request.
const Accept = "Accept"
Accept header field is used to specify certain media types which are acceptable for the response.
const AcceptCH = "Accept-CH"
AcceptCH header field is used to indicate which client hints the server supports.
const AcceptCHLifetime = "Accept-CH-Lifetime"
AcceptCHLifetime header field is used to indicate the maximum duration (in seconds) for which the user agent should store and make use of the received server configuration.
const AcceptCharset = "Accept-Charset"
AcceptCharset header field is used to indicate which character encodings are acceptable in the response.
const AcceptDatetime = "Accept-Datetime"
AcceptDatetime header field is used to indicate the date and time formats that the client supports.
const AcceptEncoding = "Accept-Encoding"
AcceptEncoding header field is used to indicate which content codings are acceptable in the response.
const AcceptLanguage = "Accept-Language"
AcceptLanguage header field is used to indicate which natural languages are preferred for the response.
const AcceptPatch = "Accept-Patch"
AcceptPatch header field is used to indicate which patch document formats are accepted by the server.
const AcceptPost = "Accept-Post"
AcceptPost header field is used to indicate which media types are accepted in the body of the request if the request method does not natively support the media type.
const AcceptRanges = "Accept-Ranges"
AcceptRanges header field is used to indicate which range units are supported by the server.
const AccessControlAllowCredentials = "Access-Control-Allow-Credentials"
AccessControlAllowCredentials header field is used to indicate whether the response can be shared when requests are made with credentials.
const AccessControlAllowHeaders = "Access-Control-Allow-Headers"
AccessControlAllowHeaders header field is used to specify which headers are allowed in a preflight request via the Access-Control-Request-Headers header.
const AccessControlAllowMethods = "Access-Control-Allow-Methods"
AccessControlAllowMethods header field is used to specify the methods that are allowed when accessing the resource in response to a preflight request.
const AccessControlAllowOrigin = "Access-Control-Allow-Origin"
AccessControlAllowOrigin header field is used to specify which origins are allowed to access the resource.
const AccessControlExposeHeaders = "Access-Control-Expose-Headers"
AccessControlExposeHeaders header field is used to specify which headers should be exposed to the response.
const AccessControlMaxAge = "Access-Control-Max-Age"
AccessControlMaxAge header field is used to indicate how long the results of a preflight request can be cached.
const AccessControlRequestHeaders = "Access-Control-Request-Headers"
AccessControlRequestHeaders header field is used to indicate which headers can be used during the actual request.
const AccessControlRequestMethod = "Access-Control-Request-Method"
AccessControlRequestMethod header field is used to indicate which method can be used during the actual request.
const Age = "Age"
Age header field is used to indicate the age of the response.
const Allow = "Allow"
Allow header field is used to indicate the HTTP methods that are supported by the resource.
const AltSvc = "Alt-Svc"
AltSvc header field is used to indicate that an alternative service is available for the given resource.
const AltUsed = "Alt-Used"
AltUsed header field is used to indicate which alternative service was selected and why.
const Authorization = "Authorization"
Authorization header field is used to contain credentials for authenticating the client with the server.
const CacheControl = "Cache-Control"
CacheControl header field is used to specify directives for caching mechanisms in both requests and responses.
const ClearSiteData = "Clear-Site-Data"
ClearSiteData header field is used to instruct the user agent to clear the browsing context's data.
const Connection = "Connection"
Connection header field is used to control options for the current connection.
const ContentDPR = "Content-DPR"
ContentDPR header field is used to specify the ratio of physical pixels to CSS pixels for the resource.
const ContentDisposition = "Content-Disposition"
ContentDisposition header field is used to suggest a default filename for the data if the user decides to save it to a file.
const ContentEncoding = "Content-Encoding"
ContentEncoding header field is used to specify the encoding transformations that have been applied to the resource.
const ContentLanguage = "Content-Language"
ContentLanguage header field is used to describe the natural language(s) of the intended audience for the representation.
const ContentLength = "Content-Length"
ContentLength header field is used to indicate the size of the response body in octets (8-bit bytes).
const ContentLocation = "Content-Location"
ContentLocation header field is used to provide a URI for the source of the representation.
const ContentMD5 = "Content-MD5"
ContentMD5 header field is used as an integrity check of the entity body.
const ContentRange = "Content-Range"
ContentRange header field is used to indicate where in a full body message a partial message belongs.
const ContentSecurityPolicy = "Content-Security-Policy"
ContentSecurityPolicy header field is used to define a Content Security Policy (CSP) that should be applied to the response.
const ContentSecurityPolicyReportOnly = "Content-Security-Policy-Report-Only"
ContentSecurityPolicyReportOnly header field is used to define a Content Security Policy (CSP) for the user agent to enforce.
const ContentType = "Content-Type"
ContentType header field is used to indicate the media type of the resource.
const Cookie = "Cookie"
Cookie header field is used to send cookies from the server to the user agent.
const CorrelationID = "Correlation-ID"
CorrelationID header field is used to uniquely identify a request in a distributed system.
const CriticalCH = "Critical-CH"
CriticalCH header field is used to indicate which client hints are critical for the server to deliver an effective response.
const CrossOriginEmbedderPolicy = "Cross-Origin-Embedder-Policy"
CrossOriginEmbedderPolicy header field is used to specify which state the user agent should apply to cross-origin requests initiated by the resource.
const CrossOriginOpenerPolicy = "Cross-Origin-Opener-Policy"
CrossOriginOpenerPolicy header field is used to specify which state the user agent should apply to cross-origin windows.
const CrossOriginResourcePolicy = "Cross-Origin-Resource-Policy"
CrossOriginResourcePolicy header field is used to specify which state the user agent should apply to a cross-origin request for the resource.
const DNT = "DNT"
DNT (Do Not Track) header field is used to inform websites that the user does not want to be tracked.
const DPR = "DPR"
DPR (Device Pixel Ratio) header field is used to indicate the ratio of physical pixels to CSS pixels for the current display device.
const Date = "Date"
Date header field is used to represent the date and time at which the message was sent.
const DeltaBase = "Delta-Base"
DeltaBase header field is used to indicate the delta encoding base resource URI.
const DeviceMemory = "Device-Memory"
DeviceMemory header field is used to indicate the approximate amount of RAM the device has available.
const Digest = "Digest"
Digest header field is used to indicate the digest algorithm and value for the resource.
const Downlink = "Downlink"
Downlink header field is used to indicate the effective network bandwidth in megabits per second.
const ECT = "ECT"
ECT (Effective Connection Type) header field is used to indicate the effective network type and its maximum downlink speed.
const ETag = "ETag"
ETag header field is used to provide the current entity tag for the requested resource.
const EarlyData = "Early-Data"
EarlyData header field is used to indicate that the request should be handled as early data.
const Expect = "Expect"
Expect header field is used to indicate certain requirements that the server must fulfill to create an HTTP response.
const ExpectCT = "Expect-CT"
ExpectCT header field is used to indicate that the server must support the Expect-CT header field.
const Expires = "Expires"
Expires header field is used to specify the date and time after which the response is considered stale.
const Forwarded = "Forwarded"
Forwarded header field is used to capture the information of the originating client and any intermediate proxies or gateways.
const From = "From"
From header field is used to indicate an Internet email address for a human user who controls the requesting user agent.
const FrontEndHTTPS = "Front-End-Https"
FrontEndHTTPS header field is used to indicate that the client connected via HTTPS.
const HTTP2Settings = "HTTP2-Settings"
HTTP2Settings header field is used to convey the HTTP/2 settings for a peer.
const Host = "Host"
Host header field is used to specify the domain name of the server and the TCP port number on which the server is listening.
const IM = "IM"
IM header field is used to indicate the instance-manipulations that have been applied to the response.
const IfMatch = "If-Match"
IfMatch header field is used to make a request method conditional on the current existence or value of an entity.
const IfModifiedSince = "If-Modified-Since"
IfModifiedSince header field is used to make a request method conditional on the modification date of the resource.
const IfNoneMatch = "If-None-Match"
IfNoneMatch header field is used to make a request method conditional on the absence or presence of a current representation of the target resource.
const IfRange = "If-Range"
IfRange header field is used to make a range request that is conditional on the state of the target resource.
const IfUnmodifiedSince = "If-Unmodified-Since"
IfUnmodifiedSince header field is used to make a request method conditional on the absence or presence and modification date of a current representation of the target resource.
const KeepAlive = "Keep-Alive"
KeepAlive header field is used to allow the sender to hint about how the connection might be used.
const LargeAllocation = "Large-Allocation"
LargeAllocation header field is used to indicate that the response is a large allocation of resources.
const LastModified = "Last-Modified"
LastModified header field is used to indicate the date and time at which the origin server believes the resource was last modified.
const Link = "Link"
Link header field is used to convey one or more links in the HTTP header.
const Location = "Location"
Location header field is used in the responses from an HTTP server to redirect the recipient to a different URL.
const MaxForwards = "Max-Forwards"
MaxForwards header field is used to limit the number of times that the request is forwarded by proxies or gateways.
const NEL = "NEL"
NEL (Network Error Logging) header field is used to send reports of network errors from the document to a receiver.
const Origin = "Origin"
Origin header field is used to indicate the origin of the resource.
const P3P = "P3P"
P3P (Platform for Privacy Preferences) header field is used to indicate the privacy policy of the server.
const PermissionsPolicy = "Permissions-Policy"
PermissionsPolicy header field is used to enable an API to allow or deny the use of features that may allow for access to device capabilities or user data.
const Pragma = "Pragma"
Pragma header field is used to include implementation-specific directives that might apply to any recipient along the request/response chain.
const Prefer = "Prefer"
Prefer header field is used to indicate the request's preferences regarding specific behaviors, such as return representations or server processing.
const PreferenceApplied = "Preference-Applied"
PreferenceApplied header field is used to indicate the request's preferences that have been applied by the server.
const ProxyAuthenticate = "Proxy-Authenticate"
ProxyAuthenticate header field is used to challenge the authorization of the client before a proxy can be set up.
const ProxyAuthorization = "Proxy-Authorization"
ProxyAuthorization header field is used to provide authentication information for proxies that require authentication.
const ProxyConnection = "Proxy-Connection"
ProxyConnection header field is used to specify options for the connection.
const PublicKeyPins = "Public-Key-Pins"
PublicKeyPins header field is used to associate a specific cryptographic public key with a certain web server.
const RTT = "RTT"
RTT (Round-Trip Time) header field is used to indicate the round-trip time of the connection.
const Range = "Range"
Range header field is used to request only part of an entity in the response.
const Referer = "Referer"
Referer header field specifies the address of the previous web page from which a link to the currently requested page was followed.
const ReferrerPolicy = "Referrer-Policy"
ReferrerPolicy header field controls how much referrer information (sent via the Referer header) should be included with requests.
const Refresh = "Refresh"
Refresh header field is used to specify a delay before the browser should reload the current resource.
const ReportTo = "Report-To"
ReportTo header field is used to specify a URI to which the user agent sends reports about various issues.
const RetryAfter = "Retry-After"
RetryAfter header field indicates how long the user agent should wait before making a follow-up request.
const SaveData = "Save-Data"
SaveData header field is used to indicate that the user's data saver is enabled.
const SecCHPrefersColorScheme = "Sec-CH-Prefers-Color-Scheme"
SecCHPrefersColorScheme header field is used to indicate the user's preference for a light or dark color scheme.
const SecCHPrefersReducedMotion = "Sec-CH-Prefers-Reduced-Motion"
SecCHPrefersReducedMotion header field is used to indicate the user's preference for reduced motion.
const SecCHPrefersReducedTransparency = "Sec-CH-Prefers-Reduced-Transparency"
SecCHPrefersReducedTransparency header field is used to indicate the user's preference for reduced transparency.
const SecCHUA = "Sec-CH-UA"
SecCHUA header field is used to indicate the user agent string.
const SecCHUAArch = "Sec-CH-UA-Arch"
SecCHUAArch header field is used to indicate the architecture of the user agent.
const SecCHUABitness = "Sec-CH-UA-Bitness"
SecCHUABitness header field is used to indicate the bitness of the user agent.
const SecCHUAFullVersion = "Sec-CH-UA-Full-Version"
SecCHUAFullVersion header field is used to indicate the full version of the user agent.
const SecCHUAFullVersionList = "Sec-CH-UA-Full-Version-List"
SecCHUAFullVersionList header field is used to indicate a list of full versions of the user agent.
const SecCHUAMobile = "Sec-CH-UA-Mobile"
SecCHUAMobile header field is used to indicate whether the user agent is a mobile device.
const SecCHUAModel = "Sec-CH-UA-Model"
SecCHUAModel header field is used to indicate the model of the user agent device.
const SecCHUAPlatform = "Sec-CH-UA-Platform"
SecCHUAPlatform header field is used to indicate the platform of the user agent.
const SecCHUAPlatformVersion = "Sec-CH-UA-Platform-Version"
SecCHUAPlatformVersion header field is used to indicate the version of the platform of the user agent.
const SecFetchDest = "Sec-Fetch-Dest"
SecFetchDest header field is used to indicate the destination of the fetch request.
const SecFetchMode = "Sec-Fetch-Mode"
SecFetchMode header field is used to indicate the mode of the fetch request.
const SecFetchSite = "Sec-Fetch-Site"
SecFetchSite header field is used to indicate the site of the fetch request.
const SecFetchUser = "Sec-Fetch-User"
SecFetchUser header field is used to indicate the user of the fetch request.
const SecGPC = "Sec-GPC"
SecGPC header field is used to indicate the privacy preferences of the user.
const SecPurpose = "Sec-Purpose"
SecPurpose header field is used to indicate the purpose of the request.
const SecWebSocketAccept = "Sec-WebSocket-Accept"
SecWebSocketAccept header field is used in the handshake to indicate the accept value.
const Server = "Server"
Server header field is used to provide information about the software used by the origin server.
const ServerTiming = "Server-Timing"
ServerTiming header field is used to communicate one or more metrics and descriptions for the given request-response cycle.
ServiceWorkerNavigationPreload header field is used to indicate the navigation preload state of the service worker.
const SetCookie = "Set-Cookie"
SetCookie header field is used to send cookies from the server to the user agent.
const SourceMap = "SourceMap"
SourceMap header field is used to indicate the source map for the requested resource.
const Status = "Status"
Status header field is used to indicate the status of the response.
const StrictTransportSecurity = "Strict-Transport-Security"
StrictTransportSecurity header field is used to enable the browser to enforce the use of HTTPS.
const SupportsLoadingMode = "Supports-Loading-Mode"
SupportsLoadingMode header field is used to opt-in to using various higher-risk loading modes.
const TE = "TE"
TE header field is used to indicate the transfer codings that are acceptable to the client.
const TK = "Tk"
TK header field is used to communicate the tracking status requested by the user.
const TimingAllowOrigin = "Timing-Allow-Origin"
TimingAllowOrigin header field is used to specify origins that are allowed to see values of attributes retrieved via features of the Resource Timing API.
const Trailer = "Trailer"
Trailer header field is used to indicate that the given set of header fields is present in the trailer of a message encoded with chunked transfer-coding.
const TransferEncoding = "Transfer-Encoding"
TransferEncoding header field is used to specify the transfer coding of the response.
const Upgrade = "Upgrade"
Upgrade header field is used to specify additional communication options for the client.
const UpgradeInsecureRequests = "Upgrade-Insecure-Requests"
UpgradeInsecureRequests header field is used to instruct user agents to treat all of a site's insecure URLs (HTTP) as though they have been replaced with secure URLs (HTTPS).
const UserAgent = "User-Agent"
UserAgent header field is used to provide information about the user agent (client) making the request.
const Vary = "Vary"
Vary header field is used to indicate the set of request-header fields that fully determines, while the response is fresh, whether a cache is permitted to use the response to reply to a subsequent request without revalidation.
const Via = "Via"
Via header field is used to indicate the network path taken by the request message.
const ViewportWidth = "Viewport-Width"
ViewportWidth header field is used to specify the layout width of the viewport.
const WWWAuthenticate = "WWW-Authenticate"
WWWAuthenticate header field is used to indicate the authentication method(s) and realm(s) acceptable to the recipient.
const WantDigest = "Want-Digest"
WantDigest header field is used to indicate that the client supports header field digest values and which algorithm the client prefers.
const Warning = "Warning"
Warning header field is used to carry additional information about the status or transformation of a message that might not be reflected in the message.
const Width = "Width"
Width header field is used to specify the intended display width of the resource in CSS pixels.
const XATTDeviceID = "X-ATT-DeviceId"
XATTDeviceID header field is used to uniquely identify a device in the network.
const XCSRFToken = "X-Csrf-Token"
XCSRFToken header field is used to provide anti-CSRF (Cross-Site Request Forgery) tokens.
const XContentDuration = "X-Content-Duration"
XContentDuration header field is used to specify the duration of the resource's content.
const XContentSecurityPolicy = "X-Content-Security-Policy"
XContentSecurityPolicy header field is used to define a Content Security Policy (CSP) that should be applied to the response.
const XContentTypeOptions = "X-Content-Type-Options"
XContentTypeOptions header field is used to prevent browsers from interpreting files as a different MIME type.
const XCorrelationID = "X-Correlation-ID"
XCorrelationID header field is used to uniquely identify a request in a distributed system.
const XDNSPrefetchControl = "X-DNS-Prefetch-Control"
XDNSPrefetchControl header field is used to control DNS prefetching.
const XForwardedFor = "X-Forwarded-For"
XForwardedFor header field is used to identify the originating IP address of a client connecting to a web server through an HTTP proxy or a load balancer.
const XForwardedHost = "X-Forwarded-Host"
XForwardedHost header field is used to identify the original host requested by the client in the Host HTTP request header.
const XForwardedProto = "X-Forwarded-Proto"
XForwardedProto header field is used to indicate the original protocol (HTTP or HTTPS) that a client used to connect to your proxy or load balancer.
const XFrameOptions = "X-Frame-Options"
XFrameOptions header field is used to control whether a browser should be allowed to render a page in a <frame>, <iframe>, <embed>, <object>, or <applet>.
const XHTTPMethodOverride = "X-Http-Method-Override"
XHTTPMethodOverride header field is used to override the method specified in the request line with the method given in the header field.
const XPoweredBy = "X-Powered-By"
XPoweredBy header field is used to indicate the technology (e.g., server framework, language) powering a website.
const XRedirectBy = "X-Redirect-By"
XRedirectBy header field is used to indicate the entity responsible for the redirection in the response.
const XRequestID = "X-Request-ID"
XRequestID header field is used to uniquely identify a request.
const XRequestedWith = "X-Requested-With"
XRequestedWith header field is used to indicate the type of request (e.g., XMLHttpRequest) made by the user agent.
const XUACompatible = "X-UA-Compatible"
XUACompatible header field is used to control the version of Internet Explorer (IE) that a web page should be rendered as.
const XUIDH = "X-UIDH"
XUIDH header field is used to enable a service provider to uniquely identify a subscriber.
const XWapProfile = "X-Wap-Profile"
XWapProfile header field is used to provide a link to a WAP (Wireless Application Protocol) profile document.
const XWebKitCSP = "X-WebKit-CSP"
XWebKitCSP header field is used to specify a Content Security Policy (CSP) for a web page.
const XXSSProtection = "X-XSS-Protection"
XXSSProtection header field is used to enable or disable the Cross-site Scripting (XSS) filter in the user agent.
Variables ΒΆ
This section is empty.
Functions ΒΆ
func NewHeaders ΒΆ added in v1.0.0
NewHeaders creates a new http.Header instance from a collection of Header structs. It takes a variadic number of *Header pointers as input, where each Header contains information about an HTTP header including its name and associated values. The function creates an http.Header instance and populates it with the provided headers' names as keys and their associated values as slices of strings.
// Create a new Header instance. header1 := goheader.Header{ Name: "Content-Type", Values: []string{"application/json"}} // Create another Header instance. header2 := goheader.Header{ Name: "Authorization", Values: []string{"Bearer Token"}} headers := goheader.NewHeaders(header1, header2) fmt.Println(headers) // Output: map[Content-Type:[application/json] Authorization:[Bearer Token]]
func WriteHeaders ΒΆ added in v1.0.0
WriteHeaders writes the provided headers to the given http.ResponseWriter object. It maps the headers based on their names to the corresponding values and sets them in the http.ResponseWriter object's header. If a header with the same name already exists, its values will be updated with the new ones provided.
// 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" ] } })
Example ΒΆ
ExampleWriteHeaders is an example function for WriteHeaders.
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()) }) // Set the port for the server. serverAddress := fmt.Sprintf(":%d", 8080) // Serve content. log.Println(http.ListenAndServe(serverAddress, nil)) }
Output:
Types ΒΆ
type Header ΒΆ added in v1.0.0
type Header struct { Experimental bool // Experimental indicates whether the header is an experimental HTTP header. Name string // Name represents the name of the header. Request bool // Request indicates whether the header is applicable for HTTP requests. Response bool // Response indicates whether the header is applicable for HTTP responses. Standard bool // Standard indicates whether the header is a standard HTTP header. Values []string // Values contains the associated values of the header. }
Header represents an HTTP header.
func NewAIMHeader ΒΆ added in v1.0.0
NewAIMHeader creates a new A-IM Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/A-IM
// Create a new Header instance. newHeader := goheader.NewAIMHeader("Example", "Values") fmt.Println(newHeader.Name) // A-IM fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewAIMHeader is an example function for NewAIMHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewAIMHeader("feed") fmt.Println(header) }
Output:
func NewAcceptCHHeader ΒΆ added in v1.0.0
NewAcceptCHHeader creates a new Accept-CH Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-CH
// Create a new Header instance. newHeader := goheader.NewAcceptCHHeader("Example", "Values") fmt.Println(newHeader.Name) // Accept-CH fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewAcceptCHHeader is an example function for NewAcceptCHHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewAcceptCHHeader("width") fmt.Println(header) }
Output:
func NewAcceptCHLifetimeHeader ΒΆ added in v1.0.0
NewAcceptCHLifetimeHeader creates a new Accept-CH-Lifetime Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-CH-Lifetime
// Create a new Header instance. newHeader := goheader.NewAcceptCHLifetimeHeader("Example", "Values") fmt.Println(newHeader.Name) // Accept-CH-Lifetime fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewAcceptCHLifetimeHeader is an example function for NewAcceptCHLifetimeHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewAcceptCHLifetimeHeader("86400") fmt.Println(header) }
Output:
func NewAcceptCharsetHeader ΒΆ added in v1.0.0
NewAcceptCharsetHeader creates a new Accept-Charset Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Charset
// Create a new Header instance. newHeader := goheader.NewAcceptCharsetHeader("Example", "Values") fmt.Println(newHeader.Name) // Accept-Charset fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewAcceptCharsetHeader("UTF-8") fmt.Println(header) }
Output:
func NewAcceptDatetimeHeader ΒΆ added in v1.0.0
NewAcceptDatetimeHeader creates a new Accept-Datetime Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Datetime
// Create a new Header instance. newHeader := goheader.NewAcceptDatetimeHeader("Example", "Values") fmt.Println(newHeader.Name) // Accept-Datetime fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewAcceptDatetimeHeader is an example function for NewAcceptDatetimeHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewAcceptDatetimeHeader("Thu, 31 May 2007 20:35:00 GMT") fmt.Println(header) }
Output:
func NewAcceptEncodingHeader ΒΆ added in v1.0.0
NewAcceptEncodingHeader creates a new Accept-Encoding Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding
// Create a new Header instance. newHeader := goheader.NewAcceptEncodingHeader("Example", "Values") fmt.Println(newHeader.Name) // Accept-Encoding fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewAcceptEncodingHeader is an example function for NewAcceptEncodingHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewAcceptEncodingHeader("gzip") fmt.Println(header) }
Output:
func NewAcceptHeader ΒΆ added in v1.0.0
NewAcceptHeader creates a new Accept Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept
// Create a new Header instance. newHeader := goheader.NewAcceptHeader("Example", "Values") fmt.Println(newHeader.Name) // Accept fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewAcceptHeader is an example function for NewAcceptHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewAcceptHeader("text/html") fmt.Println(header) }
Output:
func NewAcceptLanguageHeader ΒΆ added in v1.0.0
NewAcceptLanguageHeader creates a new Accept-Language Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language
// Create a new Header instance. newHeader := goheader.NewAcceptLanguageHeader("Example", "Values") fmt.Println(newHeader.Name) // Accept-Language fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewAcceptLanguageHeader is an example function for NewAcceptLanguageHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewAcceptLanguageHeader("en-AU") fmt.Println(header) }
Output:
func NewAcceptPatchHeader ΒΆ added in v1.0.0
NewAcceptPatchHeader creates a new Accept-Patch Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Patch
// Create a new Header instance. newHeader := goheader.NewAcceptPatchHeader("Example", "Values") fmt.Println(newHeader.Name) // Accept-Patch fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewAcceptPatchHeader is an example function for NewAcceptPatchHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewAcceptPatchHeader("application/example", "text/example") fmt.Println(header) }
Output:
func NewAcceptPostHeader ΒΆ added in v1.0.0
NewAcceptPostHeader creates a new Accept-Post Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Post
// Create a new Header instance. newHeader := goheader.NewAcceptPostHeader("Example", "Values") fmt.Println(newHeader.Name) // Accept-Post fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewAcceptPostHeader is an example function for NewAcceptPostHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewAcceptPostHeader("application/example", "text/example") fmt.Println(header) }
Output:
func NewAcceptRangesHeader ΒΆ added in v1.0.0
NewAcceptRangesHeader creates a new Accept-Ranges Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Ranges
// Create a new Header instance. newHeader := goheader.NewAcceptRangesHeader("Example", "Values") fmt.Println(newHeader.Name) // Accept-Ranges fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewAcceptRangesHeader is an example function for NewAcceptRangesHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewAcceptRangesHeader("bytes") fmt.Println(header) }
Output:
func NewAccessControlAllowCredentialsHeader ΒΆ added in v1.0.0
NewAccessControlAllowCredentialsHeader creates a new Access-Control-Allow-Credentials Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials
// Create a new Header instance. newHeader := goheader.NewAccessControlAllowCredentialsHeader("Example", "Values") fmt.Println(newHeader.Name) // Access-Control-Allow-Credentials fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewAccessControlAllowCredentialsHeader is an example function for NewAccessControlAllowCredentialsHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewAccessControlAllowCredentialsHeader("true") fmt.Println(header) }
Output:
func NewAccessControlAllowHeadersHeader ΒΆ added in v1.0.0
NewAccessControlAllowHeadersHeader creates a new Access-Control-Allow-Headers Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers
// Create a new Header instance. newHeader := goheader.NewAccessControlAllowHeadersHeader("Example", "Values") fmt.Println(newHeader.Name) // Access-Control-Allow-Headers fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewAccessControlAllowHeadersHeader is an example function for NewAccessControlAllowHeadersHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewAccessControlAllowHeadersHeader("*") fmt.Println(header) }
Output:
func NewAccessControlAllowMethodsHeader ΒΆ added in v1.0.0
NewAccessControlAllowMethodsHeader creates a new Access-Control-Allow-Methods Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods
// Create a new Header instance. newHeader := goheader.NewAccessControlAllowMethodsHeader("Example", "Values") fmt.Println(newHeader.Name) // Access-Control-Allow-Methods fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewAccessControlAllowMethodsHeader is an example function for NewAccessControlAllowMethodsHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewAccessControlAllowMethodsHeader("POST", "GET") fmt.Println(header) }
Output:
func NewAccessControlAllowOriginHeader ΒΆ added in v1.0.0
NewAccessControlAllowOriginHeader creates a new Access-Control-Allow-Origin Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin
// Create a new Header instance. newHeader := goheader.NewAccessControlAllowOriginHeader("Example", "Values") fmt.Println(newHeader.Name) // Access-Control-Allow-Origin fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewAccessControlAllowOriginHeader is an example function for NewAccessControlAllowOriginHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewAccessControlAllowOriginHeader("*") fmt.Println(header) }
Output:
func NewAccessControlExposeHeadersHeader ΒΆ added in v1.0.0
NewAccessControlExposeHeadersHeader creates a new Access-Control-Expose-Headers Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers
// Create a new Header instance. newHeader := goheader.NewAccessControlExposeHeadersHeader("Example", "Values") fmt.Println(newHeader.Name) // Access-Control-Expose-Headers fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewAccessControlExposeHeadersHeader is an example function for NewAccessControlExposeHeadersHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewAccessControlExposeHeadersHeader("https://github.com") fmt.Println(header) }
Output:
func NewAccessControlMaxAgeHeader ΒΆ added in v1.0.0
NewAccessControlMaxAgeHeader creates a new Access-Control-Max-Age Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Max-Age
// Create a new Header instance. newHeader := goheader.NewAccessControlMaxAgeHeader("Example", "Values") fmt.Println(newHeader.Name) // Access-Control-Max-Age fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewAccessControlMaxAgeHeader is an example function for NewAccessControlMaxAgeHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewAccessControlMaxAgeHeader("600") fmt.Println(header) }
Output:
func NewAccessControlRequestHeadersHeader ΒΆ added in v1.0.0
NewAccessControlRequestHeadersHeader creates a new Access-Control-Request-Headers Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Request-Headers
// Create a new Header instance. newHeader := goheader.NewAccessControlRequestHeadersHeader("Example", "Values") fmt.Println(newHeader.Name) // Access-Control-Request-Headers fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewAccessControlRequestHeadersHeader is an example function for NewAccessControlRequestHeadersHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewAccessControlRequestHeadersHeader("Content-Type", "X-User-Addr") fmt.Println(header) }
Output:
func NewAccessControlRequestMethodHeader ΒΆ added in v1.0.0
NewAccessControlRequestMethodHeader creates a new Access-Control-Request-Method Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Request-Method
// Create a new Header instance. newHeader := goheader.NewAccessControlRequestMethodHeader("Example", "Values") fmt.Println(newHeader.Name) // Access-Control-Request-Method fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewAccessControlRequestMethodHeader is an example function for NewAccessControlRequestMethodHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewAccessControlRequestMethodHeader("GET") fmt.Println(header) }
Output:
func NewAgeHeader ΒΆ added in v1.0.0
NewAgeHeader creates a new Age Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Age
// Create a new Header instance. newHeader := goheader.NewAgeHeader("Example", "Values") fmt.Println(newHeader.Name) // Age fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewAgeHeader is an example function for NewAgeHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewAgeHeader("15") fmt.Println(header) }
Output:
func NewAllowHeader ΒΆ added in v1.0.0
NewAllowHeader creates a new Allow Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Allow
// Create a new Header instance. newHeader := goheader.NewAllowHeader("Example", "Values") fmt.Println(newHeader.Name) // Allow fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewAllowHeader is an example function for NewAllowHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewAllowHeader("HEAD", "GET") fmt.Println(header) }
Output:
func NewAltSvcHeader ΒΆ added in v1.0.0
NewAltSvcHeader creates a new Alt-Svc Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Alt-Svc
// Create a new Header instance. newHeader := goheader.NewAltSvcHeader("Example", "Values") fmt.Println(newHeader.Name) // Alt-Svc fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewAltSvcHeader is an example function for NewAltSvcHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewAltSvcHeader("h2=\"alt.example.com:443\"", "h2=\":443\"") fmt.Println(header) }
Output:
func NewAltUsedHeader ΒΆ added in v1.0.0
NewAltUsedHeader creates a new Alt-Used Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Alt-Used
// Create a new Header instance. newHeader := goheader.NewAltUsedHeader("Example", "Values") fmt.Println(newHeader.Name) // Alt-Used fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewAltUsedHeader is an example function for NewAltUsedHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewAltUsedHeader("alternate.example.net") fmt.Println(header) }
Output:
func NewAuthorizationHeader ΒΆ added in v1.0.0
NewAuthorizationHeader creates a new Authorization Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization
// Create a new Header instance. newHeader := goheader.NewAuthorizationHeader("Example", "Values") fmt.Println(newHeader.Name) // Authorization fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewAuthorizationHeader is an example function for NewAuthorizationHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewAuthorizationHeader("Basic RXhhbXBsZTphaQ==") fmt.Println(header) }
Output:
func NewCacheControlHeader ΒΆ added in v1.0.0
NewCacheControlHeader creates a new Cache-Control Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
// Create a new Header instance. newHeader := goheader.NewCacheControlHeader("Example", "Values") fmt.Println(newHeader.Name) // Cache-Control fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewCacheControlHeader is an example function for NewCacheControlHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewCacheControlHeader("max-age=604800") fmt.Println(header) }
Output:
func NewClearSiteDataHeader ΒΆ added in v1.0.0
NewClearSiteDataHeader creates a new Clear-Site-Data Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Clear-Site-Data
// Create a new Header instance. newHeader := goheader.NewClearSiteDataHeader("Example", "Values") fmt.Println(newHeader.Name) // Clear-Site-Data fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewClearSiteDataHeader is an example function for NewClearSiteDataHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewClearSiteDataHeader("*") fmt.Println(header) }
Output:
func NewConnectionHeader ΒΆ added in v1.0.0
NewConnectionHeader creates a new Connection Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Connection
// Create a new Header instance. newHeader := goheader.NewConnectionHeader("Example", "Values") fmt.Println(newHeader.Name) // Connection fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewConnectionHeader is an example function for NewConnectionHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewConnectionHeader("keep-alive") fmt.Println(header) }
Output:
func NewContentDPRHeader ΒΆ added in v1.0.0
NewContentDPRHeader creates a new Content-DPR Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-DPR
// Create a new Header instance. newHeader := goheader.NewContentDPRHeader("Example", "Values") fmt.Println(newHeader.Name) // Content-DPR fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewContentDPRHeader is an example function for NewContentDPRHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewContentDPRHeader("1") fmt.Println(header) }
Output:
func NewContentDispositionHeader ΒΆ added in v1.0.0
NewContentDispositionHeader creates a new Content-Disposition Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition
// Create a new Header instance. newHeader := goheader.NewContentDispositionHeader("Example", "Values") fmt.Println(newHeader.Name) // Content-Disposition fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewContentDispositionHeader is an example function for NewContentDispositionHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewContentDispositionHeader("attachment; filename=\"document.doc\"") fmt.Println(header) }
Output:
func NewContentEncodingHeader ΒΆ added in v1.0.0
NewContentEncodingHeader creates a new Content-Encoding Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding
// Create a new Header instance. newHeader := goheader.NewContentEncodingHeader("Example", "Values") fmt.Println(newHeader.Name) // Content-Encoding fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewContentEncodingHeader is an example function for NewContentEncodingHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewContentEncodingHeader("deflate", "br") fmt.Println(header) }
Output:
func NewContentLanguageHeader ΒΆ added in v1.0.0
NewContentLanguageHeader creates a new Content-Language Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Language
// Create a new Header instance. newHeader := goheader.NewContentLanguageHeader("Example", "Values") fmt.Println(newHeader.Name) // Content-Language fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewContentLanguageHeader is an example function for NewContentLanguageHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewContentLanguageHeader("en-AU") fmt.Println(header) }
Output:
func NewContentLengthHeader ΒΆ added in v1.0.0
NewContentLengthHeader creates a new Content-Length Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Length
// Create a new Header instance. newHeader := goheader.NewContentLengthHeader("Example", "Values") fmt.Println(newHeader.Name) // Content-Length fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewContentLengthHeader is an example function for NewContentLengthHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewContentLengthHeader("128") fmt.Println(header) }
Output:
func NewContentLocationHeader ΒΆ added in v1.0.0
NewContentLocationHeader creates a new Content-Location Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Location
// Create a new Header instance. newHeader := goheader.NewContentLocationHeader("Example", "Values") fmt.Println(newHeader.Name) // Content-Location fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewContentLocationHeader is an example function for NewContentLocationHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewContentLocationHeader("https://example.com/documents/foo") fmt.Println(header) }
Output:
func NewContentMD5Header ΒΆ added in v1.0.0
NewContentMD5Header creates a new Content-MD5 Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-MD5
// Create a new Header instance. newHeader := goheader.NewContentMD5Header("Example", "Values") fmt.Println(newHeader.Name) // Content-MD5 fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewContentMD5Header is an example function for NewContentMD5Header.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewContentMD5Header("b89f948e98f3a113dc13fdbd3bdb17ef") fmt.Println(header) }
Output:
func NewContentRangeHeader ΒΆ added in v1.0.0
NewContentRangeHeader creates a new Content-Range Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range
// Create a new Header instance. newHeader := goheader.NewContentRangeHeader("Example", "Values") fmt.Println(newHeader.Name) // Content-Range fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewContentRangeHeader is an example function for NewContentRangeHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewContentRangeHeader("1000-2000/*") fmt.Println(header) }
Output:
func NewContentSecurityPolicyHeader ΒΆ added in v1.0.0
NewContentSecurityPolicyHeader creates a new Content-Security-Policy Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
// Create a new Header instance. newHeader := goheader.NewContentSecurityPolicyHeader("Example", "Values") fmt.Println(newHeader.Name) // Content-Security-Policy fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewContentSecurityPolicyHeader is an example function for NewContentSecurityPolicyHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewContentSecurityPolicyHeader("default-src 'self'; font-src fonts.gstatic.com; style-src 'self' fonts.googleapis.com") fmt.Println(header) }
Output:
func NewContentSecurityPolicyReportOnlyHeader ΒΆ added in v1.0.0
NewContentSecurityPolicyReportOnlyHeader creates a new Content-Security-Policy-Report-Only Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
// Create a new Header instance. newHeader := goheader.NewContentSecurityPolicyReportOnlyHeader("Example", "Values") fmt.Println(newHeader.Name) // Content-Security-Policy-Report-Only fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewContentSecurityPolicyReportOnlyHeader is an example function for NewContentSecurityPolicyReportOnlyHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewContentSecurityPolicyReportOnlyHeader("default-src https:; report-to /csp-violation-report-endpoint/") fmt.Println(header) }
Output:
func NewContentTypeHeader ΒΆ added in v1.0.0
NewContentTypeHeader creates a new Content-Type Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type
// Create a new Header instance. newHeader := goheader.NewContentTypeHeader("Example", "Values") fmt.Println(newHeader.Name) // Content-Type fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewContentTypeHeader is an example function for NewContentTypeHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewContentTypeHeader("text/html; charset=utf-8") fmt.Println(header) }
Output:
func NewCookieHeader ΒΆ added in v1.0.0
NewCookieHeader creates a new Cookie Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cookie
// Create a new Header instance. newHeader := goheader.NewCookieHeader("Example", "Values") fmt.Println(newHeader.Name) // Cookie fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewCookieHeader is an example function for NewCookieHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewCookieHeader("PHPSESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1") fmt.Println(header) }
Output:
func NewCorrelationIDHeader ΒΆ added in v1.0.0
NewCorrelationIDHeader creates a new Correlation-ID Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Correlation-ID
// Create a new Header instance. newHeader := goheader.NewCorrelationIDHeader("Example", "Values") fmt.Println(newHeader.Name) // Correlation-ID fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewCorrelationIDHeader is an example function for NewCorrelationIDHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewCorrelationIDHeader("93dba609-c615-4513-b95b-0d3468ec20d0") fmt.Println(header) }
Output:
func NewCriticalCHHeader ΒΆ added in v1.0.0
NewCriticalCHHeader creates a new Critical-CH Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Critical-CH
// Create a new Header instance. newHeader := goheader.NewCriticalCHHeader("Example", "Values") fmt.Println(newHeader.Name) // Critical-CH fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewCriticalCHHeader is an example function for NewCriticalCHHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewCriticalCHHeader("Sec-CH-Prefers-Reduced-Motion") fmt.Println(header) }
Output:
func NewCrossOriginEmbedderPolicyHeader ΒΆ added in v1.0.0
NewCrossOriginEmbedderPolicyHeader creates a new Cross-Origin-Embedder-Policy Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Embedder-Policy
// Create a new Header instance. newHeader := goheader.NewCrossOriginEmbedderPolicyHeader("Example", "Values") fmt.Println(newHeader.Name) // Cross-Origin-Embedder-Policy fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewCrossOriginEmbedderPolicyHeader is an example function for NewCrossOriginEmbedderPolicyHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewCrossOriginEmbedderPolicyHeader("require-corp") fmt.Println(header) }
Output:
func NewCrossOriginOpenerPolicyHeader ΒΆ added in v1.0.0
NewCrossOriginOpenerPolicyHeader creates a new Cross-Origin-Opener-Policy Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Opener-Policy
// Create a new Header instance. newHeader := goheader.NewCrossOriginOpenerPolicyHeader("Example", "Values") fmt.Println(newHeader.Name) // Cross-Origin-Opener-Policy fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewCrossOriginOpenerPolicyHeader is an example function for NewCrossOriginOpenerPolicyHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewCrossOriginOpenerPolicyHeader("same-origin-allow-popups") fmt.Println(header) }
Output:
func NewCrossOriginResourcePolicyHeader ΒΆ added in v1.0.0
NewCrossOriginResourcePolicyHeader creates a new Cross-Origin-Resource-Policy Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Resource-Policy
// Create a new Header instance. newHeader := goheader.NewCrossOriginResourcePolicyHeader("Example", "Values") fmt.Println(newHeader.Name) // Cross-Origin-Resource-Policy fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewCrossOriginResourcePolicyHeader is an example function for NewCrossOriginResourcePolicyHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewCrossOriginResourcePolicyHeader("same-origin") fmt.Println(header) }
Output:
func NewDNTHeader ΒΆ added in v1.0.0
NewDNTHeader creates a new DNT Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/DNT
// Create a new Header instance. newHeader := goheader.NewDNTHeader("Example", "Values") fmt.Println(newHeader.Name) // DNT fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewDNTHeader is an example function for NewDNTHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewDNTHeader("1") fmt.Println(header) }
Output:
func NewDPRHeader ΒΆ added in v1.0.0
NewDPRHeader creates a new DPR Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/DPR
// Create a new Header instance. newHeader := goheader.NewDPRHeader("Example", "Values") fmt.Println(newHeader.Name) // DPR fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewDPRHeader is an example function for NewDPRHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewDPRHeader("2.0") fmt.Println(header) }
Output:
func NewDateHeader ΒΆ added in v1.0.0
NewDateHeader creates a new Date Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Date
// Create a new Header instance. newHeader := goheader.NewDateHeader("Example", "Values") fmt.Println(newHeader.Name) // Date fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewDateHeader is an example function for NewDateHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewDateHeader("Wed, 21 Oct 2015 07:28:00 GMT") fmt.Println(header) }
Output:
func NewDeltaBaseHeader ΒΆ added in v1.0.0
NewDeltaBaseHeader creates a new Delta-Base Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Delta-Base
// Create a new Header instance. newHeader := goheader.NewDeltaBaseHeader("Example", "Values") fmt.Println(newHeader.Name) // Delta-Base fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewDeltaBaseHeader is an example function for NewDeltaBaseHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewDeltaBaseHeader("12340001") fmt.Println(header) }
Output:
func NewDeviceMemoryHeader ΒΆ added in v1.0.0
NewDeviceMemoryHeader creates a new Device-Memory Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Device-Memory
// Create a new Header instance. newHeader := goheader.NewDeviceMemoryHeader("Example", "Values") fmt.Println(newHeader.Name) // Device-Memory fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewDeviceMemoryHeader is an example function for NewDeviceMemoryHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewDeviceMemoryHeader("2") fmt.Println(header) }
Output:
func NewDigestHeader ΒΆ added in v1.0.0
NewDigestHeader creates a new Digest Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Digest
// Create a new Header instance. newHeader := goheader.NewDigestHeader("Example", "Values") fmt.Println(newHeader.Name) // Digest fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewDigestHeader is an example function for NewDigestHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewDigestHeader("sha-512= 3b761a2a9a96e1c430236dc31378a3450ea189ae1449c3c8eac25cfa8b25381661317968a54cf46bfced09ae6b49f8512832182ac2d087b22380fcb760d802a3") fmt.Println(header) }
Output:
func NewDownlinkHeader ΒΆ added in v1.0.0
NewDownlinkHeader creates a new Downlink Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Downlink
// Create a new Header instance. newHeader := goheader.NewDownlinkHeader("Example", "Values") fmt.Println(newHeader.Name) // Downlink fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewDownlinkHeader is an example function for NewDownlinkHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewDownlinkHeader("1.7") fmt.Println(header) }
Output:
func NewECTHeader ΒΆ added in v1.0.0
NewECTHeader creates a new ECT Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ECT
// Create a new Header instance. newHeader := goheader.NewECTHeader("Example", "Values") fmt.Println(newHeader.Name) // ECT fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewECTHeader is an example function for NewECTHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewECTHeader("2g") fmt.Println(header) }
Output:
func NewETagHeader ΒΆ added in v1.0.0
NewETagHeader creates a new ETag Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag
// Create a new Header instance. newHeader := goheader.NewETagHeader("Example", "Values") fmt.Println(newHeader.Name) // ETag fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewETagHeader is an example function for NewETagHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewETagHeader("33a64df551425fcc55e4d42a148795d9f25f89d4") fmt.Println(header) }
Output:
func NewEarlyDataHeader ΒΆ added in v1.0.0
NewEarlyDataHeader creates a new Early-Data Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Early-Data
// Create a new Header instance. newHeader := goheader.NewEarlyDataHeader("Example", "Values") fmt.Println(newHeader.Name) // Early-Data fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewEarlyDataHeader is an example function for NewEarlyDataHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewEarlyDataHeader("1") fmt.Println(header) }
Output:
func NewExpectCTHeader ΒΆ added in v1.0.0
NewExpectCTHeader creates a new Expect-CT Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expect-CT
// Create a new Header instance. newHeader := goheader.NewExpectCTHeader("Example", "Values") fmt.Println(newHeader.Name) // Expect-CT fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewExpectCTHeader is an example function for NewExpectCTHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewExpectCTHeader("max-age=86400", "enforce", "report-uri=\"https://foo.example.com/report\"") fmt.Println(header) }
Output:
func NewExpectHeader ΒΆ added in v1.0.0
NewExpectHeader creates a new Expect Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expect
// Create a new Header instance. newHeader := goheader.NewExpectHeader("Example", "Values") fmt.Println(newHeader.Name) // Expect fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewExpectHeader is an example function for NewExpectHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewExpectHeader("100-continue") fmt.Println(header) }
Output:
func NewExpiresHeader ΒΆ added in v1.0.0
NewExpiresHeader creates a new Expires Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expires
// Create a new Header instance. newHeader := goheader.NewExpiresHeader("Example", "Values") fmt.Println(newHeader.Name) // Expires fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewExpiresHeader is an example function for NewExpiresHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewExpiresHeader("Wed, 21 Oct 2015 07:28:00 GMT") fmt.Println(header) }
Output:
func NewForwardedHeader ΒΆ added in v1.0.0
NewForwardedHeader creates a new Forwarded Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Forwarded
// Create a new Header instance. newHeader := goheader.NewForwardedHeader("Example", "Values") fmt.Println(newHeader.Name) // Forwarded fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewForwardedHeader is an example function for NewForwardedHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewForwardedHeader("for=192.0.2.43", "for=198.51.100.17") fmt.Println(header) }
Output:
func NewFromHeader ΒΆ added in v1.0.0
NewFromHeader creates a new From Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/From
// Create a new Header instance. newHeader := goheader.NewFromHeader("Example", "Values") fmt.Println(newHeader.Name) // From fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewFromHeader is an example function for NewFromHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewFromHeader("webmaster@example.org") fmt.Println(header) }
Output:
func NewFrontEndHTTPSHeader ΒΆ added in v1.0.0
NewFrontEndHTTPSHeader creates a new Front-End-Https Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Front-End-Https
// Create a new Header instance. newHeader := goheader.NewFrontEndHTTPSHeader("Example", "Values") fmt.Println(newHeader.Name) // Front-End-Https fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewFrontEndHTTPSHeader is an example function for NewFrontEndHTTPSHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewFrontEndHTTPSHeader("on") fmt.Println(header) }
Output:
func NewHTTP2SettingsHeader ΒΆ added in v1.0.0
NewHTTP2SettingsHeader creates a new HTTP2-Settings Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/HTTP2-Settings
// Create a new Header instance. newHeader := goheader.NewHTTP2SettingsHeader("Example", "Values") fmt.Println(newHeader.Name) // HTTP2-Settings fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewHTTP2SettingsHeader is an example function for NewHTTP2SettingsHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewHTTP2SettingsHeader("token64") fmt.Println(header) }
Output:
func NewHostHeader ΒΆ added in v1.0.0
NewHostHeader creates a new Host Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Host
// Create a new Header instance. newHeader := goheader.NewHostHeader("Example", "Values") fmt.Println(newHeader.Name) // Host fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewHostHeader is an example function for NewHostHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewHostHeader("Host") fmt.Println(header) }
Output:
func NewIMHeader ΒΆ added in v1.0.0
NewIMHeader creates a new IM Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/IM
// Create a new Header instance. newHeader := goheader.NewIMHeader("Example", "Values") fmt.Println(newHeader.Name) // IM fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewIMHeader is an example function for NewIMHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewIMHeader("feed") fmt.Println(header) }
Output:
func NewIfMatchHeader ΒΆ added in v1.0.0
NewIfMatchHeader creates a new If-Match Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match
// Create a new Header instance. newHeader := goheader.NewIfMatchHeader("Example", "Values") fmt.Println(newHeader.Name) // If-Match fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewIfMatchHeader is an example function for NewIfMatchHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewIfMatchHeader("737060cd8c284d8af7ad3082f209582d") fmt.Println(header) }
Output:
func NewIfModifiedSinceHeader ΒΆ added in v1.0.0
NewIfModifiedSinceHeader creates a new If-Modified-Since Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Modified-Since
// Create a new Header instance. newHeader := goheader.NewIfModifiedSinceHeader("Example", "Values") fmt.Println(newHeader.Name) // If-Modified-Since fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewIfModifiedSinceHeader is an example function for NewIfModifiedSinceHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewIfModifiedSinceHeader("Sat, 29 Oct 1994 19:43:31 GMT") fmt.Println(header) }
Output:
func NewIfNoneMatchHeader ΒΆ added in v1.0.0
NewIfNoneMatchHeader creates a new If-None-Match Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-None-Match
// Create a new Header instance. newHeader := goheader.NewIfNoneMatchHeader("Example", "Values") fmt.Println(newHeader.Name) // If-None-Match fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewIfNoneMatchHeader is an example function for NewIfNoneMatchHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewIfNoneMatchHeader("737060cd8c284d8af7ad3082f209582d") fmt.Println(header) }
Output:
func NewIfRangeHeader ΒΆ added in v1.0.0
NewIfRangeHeader creates a new If-Range Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Range
// Create a new Header instance. newHeader := goheader.NewIfRangeHeader("Example", "Values") fmt.Println(newHeader.Name) // If-Range fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewIfRangeHeader is an example function for NewIfRangeHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewIfRangeHeader("737060cd8c284d8af7ad3082f209582d") fmt.Println(header) }
Output:
func NewIfUnmodifiedSinceHeader ΒΆ added in v1.0.0
NewIfUnmodifiedSinceHeader creates a new If-Unmodified-Since Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Unmodified-Since
// Create a new Header instance. newHeader := goheader.NewIfUnmodifiedSinceHeader("Example", "Values") fmt.Println(newHeader.Name) // If-Unmodified-Since fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewIfUnmodifiedSinceHeader is an example function for NewIfUnmodifiedSinceHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewIfUnmodifiedSinceHeader("Sat, 29 Oct 1994 19:43:31 GMT") fmt.Println(header) }
Output:
func NewKeepAliveHeader ΒΆ added in v1.0.0
NewKeepAliveHeader creates a new Keep-Alive Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Keep-Alive
// Create a new Header instance. newHeader := goheader.NewKeepAliveHeader("Example", "Values") fmt.Println(newHeader.Name) // Keep-Alive fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewKeepAliveHeader is an example function for NewKeepAliveHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewKeepAliveHeader("timeout=5", "max=1000") fmt.Println(header) }
Output:
func NewLargeAllocationHeader ΒΆ added in v1.0.0
NewLargeAllocationHeader creates a new Large-Allocation Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Large-Allocation
// Create a new Header instance. newHeader := goheader.NewLargeAllocationHeader("Example", "Values") fmt.Println(newHeader.Name) // Large-Allocation fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewLargeAllocationHeader is an example function for NewLargeAllocationHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewLargeAllocationHeader("500") fmt.Println(header) }
Output:
func NewLastModifiedHeader ΒΆ added in v1.0.0
NewLastModifiedHeader creates a new Last-Modified Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Last-Modified
// Create a new Header instance. newHeader := goheader.NewLastModifiedHeader("Example", "Values") fmt.Println(newHeader.Name) // Last-Modified fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewLastModifiedHeader is an example function for NewLastModifiedHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewLastModifiedHeader("Wed, 21 Oct 2015 07:28:00 GMT") fmt.Println(header) }
Output:
func NewLinkHeader ΒΆ added in v1.0.0
NewLinkHeader creates a new Link Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link
// Create a new Header instance. newHeader := goheader.NewLinkHeader("Example", "Values") fmt.Println(newHeader.Name) // Link fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewLinkHeader is an example function for NewLinkHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewLinkHeader("<https://one.example.com>; rel=\"preconnect\"", "<https://two.example.com>; rel=\"preconnect\"", "<https://three.example.com>; rel=\"preconnect\"") fmt.Println(header) }
Output:
func NewLocationHeader ΒΆ added in v1.0.0
NewLocationHeader creates a new Location Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location
// Create a new Header instance. newHeader := goheader.NewLocationHeader("Example", "Values") fmt.Println(newHeader.Name) // Location fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewLocationHeader is an example function for NewLocationHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewLocationHeader("/index.html") fmt.Println(header) }
Output:
func NewMaxForwardsHeader ΒΆ added in v1.0.0
NewMaxForwardsHeader creates a new Max-Forwards Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Max-Forwards
// Create a new Header instance. newHeader := goheader.NewMaxForwardsHeader("Example", "Values") fmt.Println(newHeader.Name) // Max-Forwards fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewMaxForwardsHeader is an example function for NewMaxForwardsHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewMaxForwardsHeader("10") fmt.Println(header) }
Output:
func NewNELHeader ΒΆ added in v1.0.0
NewNELHeader creates a new NEL Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/NEL
// Create a new Header instance. newHeader := goheader.NewNELHeader("Example", "Values") fmt.Println(newHeader.Name) // NEL fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewNELHeader is an example function for NewNELHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. 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) }
Output:
func NewOriginHeader ΒΆ added in v1.0.0
NewOriginHeader creates a new Origin Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin
// Create a new Header instance. newHeader := goheader.NewOriginHeader("Example", "Values") fmt.Println(newHeader.Name) // Origin fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewOriginHeader is an example function for NewOriginHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewOriginHeader("https://example.com") fmt.Println(header) }
Output:
func NewP3PHeader ΒΆ added in v1.0.0
NewP3PHeader creates a new P3P Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/P3P
// Create a new Header instance. newHeader := goheader.NewP3PHeader("Example", "Values") fmt.Println(newHeader.Name) // P3P fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewP3PHeader is an example function for NewP3PHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewP3PHeader("CP=\"https://example.com/P3P\"") fmt.Println(header) }
Output:
func NewPermissionsPolicyHeader ΒΆ added in v1.0.0
NewPermissionsPolicyHeader creates a new Permissions-Policy Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy
// Create a new Header instance. newHeader := goheader.NewPermissionsPolicyHeader("Example", "Values") fmt.Println(newHeader.Name) // Permissions-Policy fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewPermissionsPolicyHeader is an example function for NewPermissionsPolicyHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewPermissionsPolicyHeader("(\"https://example.com\" \"https://a.example.com\" \"https://b.example.com\" \"https://c.example.com\")") fmt.Println(header) }
Output:
func NewPragmaHeader ΒΆ added in v1.0.0
NewPragmaHeader creates a new Pragma Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Pragma
// Create a new Header instance. newHeader := goheader.NewPragmaHeader("Example", "Values") fmt.Println(newHeader.Name) // Pragma fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewPragmaHeader is an example function for NewPragmaHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewPragmaHeader("no-cache") fmt.Println(header) }
Output:
func NewPreferHeader ΒΆ added in v1.0.0
NewPreferHeader creates a new Prefer Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Prefer
// Create a new Header instance. newHeader := goheader.NewPreferHeader("Example", "Values") fmt.Println(newHeader.Name) // Prefer fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewPreferHeader is an example function for NewPreferHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewPreferHeader("respond-async", "wait=5") fmt.Println(header) }
Output:
func NewPreferenceAppliedHeader ΒΆ added in v1.0.0
NewPreferenceAppliedHeader creates a new Preference-Applied Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Preference-Applied
// Create a new Header instance. newHeader := goheader.NewPreferenceAppliedHeader("Example", "Values") fmt.Println(newHeader.Name) // Preference-Applied fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewPreferenceAppliedHeader is an example function for NewPreferenceAppliedHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewPreferenceAppliedHeader("return=representation") fmt.Println(header) }
Output:
func NewProxyAuthenticateHeader ΒΆ added in v1.0.0
NewProxyAuthenticateHeader creates a new Proxy-Authenticate Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Proxy-Authenticate
// Create a new Header instance. newHeader := goheader.NewProxyAuthenticateHeader("Example", "Values") fmt.Println(newHeader.Name) // Proxy-Authenticate fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewProxyAuthenticateHeader is an example function for NewProxyAuthenticateHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewProxyAuthenticateHeader("Basic realm=\"Access to the internal site\"") fmt.Println(header) }
Output:
func NewProxyAuthorizationHeader ΒΆ added in v1.0.0
NewProxyAuthorizationHeader creates a new Proxy-Authorization Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Proxy-Authorization
// Create a new Header instance. newHeader := goheader.NewProxyAuthorizationHeader("Example", "Values") fmt.Println(newHeader.Name) // Proxy-Authorization fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewProxyAuthorizationHeader is an example function for NewProxyAuthorizationHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewProxyAuthorizationHeader("Basic YWxhZGRpbjpvcGVuc2VzYW1l") fmt.Println(header) }
Output:
func NewProxyConnectionHeader ΒΆ added in v1.0.0
NewProxyConnectionHeader creates a new Proxy-Connection Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Proxy-Connection
// Create a new Header instance. newHeader := goheader.NewProxyConnectionHeader("Example", "Values") fmt.Println(newHeader.Name) // Proxy-Connection fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewProxyConnectionHeader is an example function for NewProxyConnectionHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewProxyConnectionHeader("keep-alive") fmt.Println(header) }
Output:
func NewPublicKeyPinsHeader ΒΆ added in v1.0.0
NewPublicKeyPinsHeader creates a new Public-Key-Pins Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Public-Key-Pins
// Create a new Header instance. newHeader := goheader.NewPublicKeyPinsHeader("Example", "Values") fmt.Println(newHeader.Name) // Public-Key-Pins fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewPublicKeyPinsHeader is an example function for NewPublicKeyPinsHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewPublicKeyPinsHeader("max-age=2592000; pin-sha256=\"E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g=\";") fmt.Println(header) }
Output:
func NewRTTHeader ΒΆ added in v1.0.0
NewRTTHeader creates a new RTT Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/RTT
// Create a new Header instance. newHeader := goheader.NewRTTHeader("Example", "Values") fmt.Println(newHeader.Name) // RTT fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewRTTHeader is an example function for NewRTTHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewRTTHeader("123") fmt.Println(header) }
Output:
func NewRangeHeader ΒΆ added in v1.0.0
NewRangeHeader creates a new Range Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range
// Create a new Header instance. newHeader := goheader.NewRangeHeader("Example", "Values") fmt.Println(newHeader.Name) // Range fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewRangeHeader is an example function for NewRangeHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewRangeHeader("bytes=200-1000", "2000-6576", "19000-") fmt.Println(header) }
Output:
func NewRefererHeader ΒΆ added in v1.0.0
NewRefererHeader creates a new Referer Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer
// Create a new Header instance. newHeader := goheader.NewRefererHeader("Example", "Values") fmt.Println(newHeader.Name) // Referer fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewRefererHeader is an example function for NewRefererHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewRefererHeader("https://example.com/") fmt.Println(header) }
Output:
func NewReferrerPolicyHeader ΒΆ added in v1.0.0
NewReferrerPolicyHeader creates a new Referrer-Policy Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy
// Create a new Header instance. newHeader := goheader.NewReferrerPolicyHeader("Example", "Values") fmt.Println(newHeader.Name) // Referrer-Policy fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewReferrerPolicyHeader is an example function for NewReferrerPolicyHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewReferrerPolicyHeader("no-referrer", "strict-origin-when-cross-origin") fmt.Println(header) }
Output:
func NewRefreshHeader ΒΆ added in v1.0.0
NewRefreshHeader creates a new Refresh Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Refresh
// Create a new Header instance. newHeader := goheader.NewRefreshHeader("Example", "Values") fmt.Println(newHeader.Name) // Refresh fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewRefreshHeader is an example function for NewRefreshHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewRefreshHeader("5; url=http://www.w3.org/pub/WWW/People.html") fmt.Println(header) }
Output:
func NewReportToHeader ΒΆ added in v1.0.0
NewReportToHeader creates a new Report-To Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Report-To
// Create a new Header instance. newHeader := goheader.NewReportToHeader("Example", "Values") fmt.Println(newHeader.Name) // Report-To fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewReportToHeader is an example function for NewReportToHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewReportToHeader("{ \"group\": \"csp-endpoint\", \"max_age\": 10886400, \"endpoints\": [ { \"url\": \"https-url-of-site-which-collects-reports\" } ] }") fmt.Println(header) }
Output:
func NewRetryAfterHeader ΒΆ added in v1.0.0
NewRetryAfterHeader creates a new Retry-After Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
// Create a new Header instance. newHeader := goheader.NewRetryAfterHeader("Example", "Values") fmt.Println(newHeader.Name) // Retry-After fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewRetryAfterHeader is an example function for NewRetryAfterHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewRetryAfterHeader("123") fmt.Println(header) }
Output:
func NewSaveDataHeader ΒΆ added in v1.0.0
NewSaveDataHeader creates a new Save-Data Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Save-Data
// Create a new Header instance. newHeader := goheader.NewSaveDataHeader("Example", "Values") fmt.Println(newHeader.Name) // Save-Data fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewSaveDataHeader is an example function for NewSaveDataHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewSaveDataHeader("on") fmt.Println(header) }
Output:
func NewSecCHPrefersColorSchemeHeader ΒΆ added in v1.0.0
NewSecCHPrefersColorSchemeHeader creates a new Sec-CH-Prefers-Color-Scheme Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-CH-Prefers-Color-Scheme
// Create a new Header instance. newHeader := goheader.NewSecCHPrefersColorSchemeHeader("Example", "Values") fmt.Println(newHeader.Name) // Sec-CH-Prefers-Color-Scheme fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewSecCHPrefersColorSchemeHeader is an example function for NewSecCHPrefersColorSchemeHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewSecCHPrefersColorSchemeHeader("dark") fmt.Println(header) }
Output:
func NewSecCHPrefersReducedMotionHeader ΒΆ added in v1.0.0
NewSecCHPrefersReducedMotionHeader creates a new Sec-CH-Prefers-Reduced-Motion Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-CH-Prefers-Reduced-Motion
// Create a new Header instance. newHeader := goheader.NewSecCHPrefersReducedMotionHeader("Example", "Values") fmt.Println(newHeader.Name) // Sec-CH-Prefers-Reduced-Motion fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewSecCHPrefersReducedMotionHeader is an example function for NewSecCHPrefersReducedMotionHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewSecCHPrefersReducedMotionHeader("reduce") fmt.Println(header) }
Output:
func NewSecCHPrefersReducedTransparencyHeader ΒΆ added in v1.0.0
NewSecCHPrefersReducedTransparencyHeader creates a new Sec-CH-Prefers-Reduced-Transparency Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-CH-Prefers-Reduced-Transparency
// Create a new Header instance. newHeader := goheader.NewSecCHPrefersReducedTransparencyHeader("Example", "Values") fmt.Println(newHeader.Name) // Sec-CH-Prefers-Reduced-Transparency fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewSecCHPrefersReducedTransparencyHeader is an example function for NewSecCHPrefersReducedTransparencyHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewSecCHPrefersReducedTransparencyHeader("reduce") fmt.Println(header) }
Output:
func NewSecCHUAArchHeader ΒΆ added in v1.0.0
NewSecCHUAArchHeader creates a new Sec-CH-UA-Arch Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-CH-UA-Arch
// Create a new Header instance. newHeader := goheader.NewSecCHUAArchHeader("Example", "Values") fmt.Println(newHeader.Name) // Sec-CH-UA-Arch fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewSecCHUAArchHeader is an example function for NewSecCHUAArchHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewSecCHUAArchHeader("x86") fmt.Println(header) }
Output:
func NewSecCHUABitnessHeader ΒΆ added in v1.0.0
NewSecCHUABitnessHeader creates a new Sec-CH-UA-Bitness Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-CH-UA-Bitness
// Create a new Header instance. newHeader := goheader.NewSecCHUABitnessHeader("Example", "Values") fmt.Println(newHeader.Name) // Sec-CH-UA-Bitness fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewSecCHUABitnessHeader is an example function for NewSecCHUABitnessHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewSecCHUABitnessHeader("64") fmt.Println(header) }
Output:
func NewSecCHUAFullVersionHeader ΒΆ added in v1.0.0
NewSecCHUAFullVersionHeader creates a new Sec-CH-UA-Full-Version Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-CH-UA-Full-Version
// Create a new Header instance. newHeader := goheader.NewSecCHUAFullVersionHeader("Example", "Values") fmt.Println(newHeader.Name) // Sec-CH-UA-Full-Version fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewSecCHUAFullVersionHeader is an example function for NewSecCHUAFullVersionHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewSecCHUAFullVersionHeader("96.0.4664.110") fmt.Println(header) }
Output:
func NewSecCHUAFullVersionListHeader ΒΆ added in v1.0.0
NewSecCHUAFullVersionListHeader creates a new Sec-CH-UA-Full-Version-List Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-CH-UA-Full-Version-List
// Create a new Header instance. newHeader := goheader.NewSecCHUAFullVersionListHeader("Example", "Values") fmt.Println(newHeader.Name) // Sec-CH-UA-Full-Version-List fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewSecCHUAFullVersionListHeader is an example function for NewSecCHUAFullVersionListHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. 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) }
Output:
func NewSecCHUAHeader ΒΆ added in v1.0.0
NewSecCHUAHeader creates a new Sec-CH-UA Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-CH-UA
// Create a new Header instance. newHeader := goheader.NewSecCHUAHeader("Example", "Values") fmt.Println(newHeader.Name) // Sec-CH-UA fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewSecCHUAHeader is an example function for NewSecCHUAHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewSecCHUAHeader("\"Opera\";v=\"81\", \" Not;A Brand\";v=\"99\", \"Chromium\";v=\"95\"") fmt.Println(header) }
Output:
func NewSecCHUAMobileHeader ΒΆ added in v1.0.0
NewSecCHUAMobileHeader creates a new Sec-CH-UA-Mobile Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-CH-UA-Mobile
// Create a new Header instance. newHeader := goheader.NewSecCHUAMobileHeader("Example", "Values") fmt.Println(newHeader.Name) // Sec-CH-UA-Mobile fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewSecCHUAMobileHeader is an example function for NewSecCHUAMobileHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewSecCHUAMobileHeader("?1") fmt.Println(header) }
Output:
func NewSecCHUAModelHeader ΒΆ added in v1.0.0
NewSecCHUAModelHeader creates a new Sec-CH-UA-Model Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-CH-UA-Model
// Create a new Header instance. newHeader := goheader.NewSecCHUAModelHeader("Example", "Values") fmt.Println(newHeader.Name) // Sec-CH-UA-Model fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewSecCHUAModelHeader is an example function for NewSecCHUAModelHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewSecCHUAModelHeader("Pixel 3 XL") fmt.Println(header) }
Output:
func NewSecCHUAPlatformHeader ΒΆ added in v1.0.0
NewSecCHUAPlatformHeader creates a new Sec-CH-UA-Platform Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-CH-UA-Platform
// Create a new Header instance. newHeader := goheader.NewSecCHUAPlatformHeader("Example", "Values") fmt.Println(newHeader.Name) // Sec-CH-UA-Platform fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewSecCHUAPlatformHeader is an example function for NewSecCHUAPlatformHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewSecCHUAPlatformHeader("macOS") fmt.Println(header) }
Output:
func NewSecCHUAPlatformVersionHeader ΒΆ added in v1.0.0
NewSecCHUAPlatformVersionHeader creates a new Sec-CH-UA-Platform-Version Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-CH-UA-Platform-Version
// Create a new Header instance. newHeader := goheader.NewSecCHUAPlatformVersionHeader("Example", "Values") fmt.Println(newHeader.Name) // Sec-CH-UA-Platform-Version fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewSecCHUAPlatformVersionHeader is an example function for NewSecCHUAPlatformVersionHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewSecCHUAPlatformVersionHeader("10.0.0") fmt.Println(header) }
Output:
func NewSecFetchDestHeader ΒΆ added in v1.0.0
NewSecFetchDestHeader creates a new Sec-Fetch-Dest Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-Fetch-Dest
// Create a new Header instance. newHeader := goheader.NewSecFetchDestHeader("Example", "Values") fmt.Println(newHeader.Name) // Sec-Fetch-Dest fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewSecFetchDestHeader is an example function for NewSecFetchDestHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewSecFetchDestHeader("image") fmt.Println(header) }
Output:
func NewSecFetchModeHeader ΒΆ added in v1.0.0
NewSecFetchModeHeader creates a new Sec-Fetch-Mode Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-Fetch-Mode
// Create a new Header instance. newHeader := goheader.NewSecFetchModeHeader("Example", "Values") fmt.Println(newHeader.Name) // Sec-Fetch-Mode fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewSecFetchModeHeader is an example function for NewSecFetchModeHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewSecFetchModeHeader("no-cors") fmt.Println(header) }
Output:
func NewSecFetchSiteHeader ΒΆ added in v1.0.0
NewSecFetchSiteHeader creates a new Sec-Fetch-Site Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-Fetch-Site
// Create a new Header instance. newHeader := goheader.NewSecFetchSiteHeader("Example", "Values") fmt.Println(newHeader.Name) // Sec-Fetch-Site fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewSecFetchSiteHeader is an example function for NewSecFetchSiteHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewSecFetchSiteHeader("cross-site") fmt.Println(header) }
Output:
func NewSecFetchUserHeader ΒΆ added in v1.0.0
NewSecFetchUserHeader creates a new Sec-Fetch-User Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-Fetch-User
// Create a new Header instance. newHeader := goheader.NewSecFetchUserHeader("Example", "Values") fmt.Println(newHeader.Name) // Sec-Fetch-User fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewSecFetchUserHeader is an example function for NewSecFetchUserHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewSecFetchUserHeader("?1") fmt.Println(header) }
Output:
func NewSecGPCHeader ΒΆ added in v1.0.0
NewSecGPCHeader creates a new Sec-GPC Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-GPC
// Create a new Header instance. newHeader := goheader.NewSecGPCHeader("Example", "Values") fmt.Println(newHeader.Name) // Sec-GPC fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewSecGPCHeader is an example function for NewSecGPCHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewSecGPCHeader("1") fmt.Println(header) }
Output:
func NewSecPurposeHeader ΒΆ added in v1.0.0
NewSecPurposeHeader creates a new Sec-Purpose Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-Purpose
// Create a new Header instance. newHeader := goheader.NewSecPurposeHeader("Example", "Values") fmt.Println(newHeader.Name) // Sec-Purpose fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewSecPurposeHeader is an example function for NewSecPurposeHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewSecPurposeHeader("prefetch") fmt.Println(header) }
Output:
func NewSecWebSocketAcceptHeader ΒΆ added in v1.0.0
NewSecWebSocketAcceptHeader creates a new Sec-WebSocket-Accept Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-WebSocket-Accept
// Create a new Header instance. newHeader := goheader.NewSecWebSocketAcceptHeader("Example", "Values") fmt.Println(newHeader.Name) // Sec-WebSocket-Accept fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewSecWebSocketAcceptHeader is an example function for NewSecWebSocketAcceptHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewSecWebSocketAcceptHeader("s3pPLMBiTxaQ9kYGzzhZRbK+xOo=") fmt.Println(header) }
Output:
func NewServerHeader ΒΆ added in v1.0.0
NewServerHeader creates a new Server Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Server
// Create a new Header instance. newHeader := goheader.NewServerHeader("Example", "Values") fmt.Println(newHeader.Name) // Server fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewServerHeader is an example function for NewServerHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewServerHeader("Apache/2.4.1 (Unix)") fmt.Println(header) }
Output:
func NewServerTimingHeader ΒΆ added in v1.0.0
NewServerTimingHeader creates a new Server-Timing Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Server-Timing
// Create a new Header instance. newHeader := goheader.NewServerTimingHeader("Example", "Values") fmt.Println(newHeader.Name) // Server-Timing fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewServerTimingHeader is an example function for NewServerTimingHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewServerTimingHeader("missedCache") fmt.Println(header) }
Output:
func NewServiceWorkerNavigationPreloadHeader ΒΆ added in v1.0.0
NewServiceWorkerNavigationPreloadHeader creates a new Service-Worker-Navigation-Preload Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Service-Worker-Navigation-Preload
// Create a new Header instance. newHeader := goheader.NewServiceWorkerNavigationPreloadHeader("Example", "Values") fmt.Println(newHeader.Name) // Service-Worker-Navigation-Preload fmt.Println(newHeader.Value) // ["Example", "Value"]
func NewSetCookieHeader ΒΆ added in v1.0.0
NewSetCookieHeader creates a new Set-Cookie Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie
// Create a new Header instance. newHeader := goheader.NewSetCookieHeader("Example", "Values") fmt.Println(newHeader.Name) // Set-Cookie fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewSetCookieHeader is an example function for NewSetCookieHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewSetCookieHeader("id=a3fWa; Expires=Wed, 21 Oct 2015 07:28:00 GM") fmt.Println(header) }
Output:
func NewSourceMapHeader ΒΆ added in v1.0.0
NewSourceMapHeader creates a new SourceMap Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/SourceMap
// Create a new Header instance. newHeader := goheader.NewSourceMapHeader("Example", "Values") fmt.Println(newHeader.Name) // SourceMap fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewSourceMapHeader is an example function for NewSourceMapHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewSourceMapHeader("/static/js/file.js") fmt.Println(header) }
Output:
func NewStatusHeader ΒΆ added in v1.0.0
NewStatusHeader creates a new Status Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Status
// Create a new Header instance. newHeader := goheader.NewStatusHeader("Example", "Values") fmt.Println(newHeader.Name) // Status fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewStatusHeader is an example function for NewStatusHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewStatusHeader("200 OK") fmt.Println(header) }
Output:
func NewStrictTransportSecurityHeader ΒΆ added in v1.0.0
NewStrictTransportSecurityHeader creates a new Strict-Transport-Security Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security
// Create a new Header instance. newHeader := goheader.NewStrictTransportSecurityHeader("Example", "Values") fmt.Println(newHeader.Name) // Strict-Transport-Security fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewStrictTransportSecurityHeader is an example function for NewStrictTransportSecurityHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewStrictTransportSecurityHeader("max-age=63072000; includeSubDomains; preload") fmt.Println(header) }
Output:
func NewSupportsLoadingModeHeader ΒΆ added in v1.0.0
NewSupportsLoadingModeHeader creates a new Supports-Loading-Mode Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Supports-Loading-Mode
// Create a new Header instance. newHeader := goheader.NewSupportsLoadingModeHeader("Example", "Values") fmt.Println(newHeader.Name) // Supports-Loading-Mode fmt.Println(newHeader.Value) // ["Example", "Value"]
func NewTEHeader ΒΆ added in v1.0.0
NewTEHeader creates a new TE Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/TE
// Create a new Header instance. newHeader := goheader.NewTEHeader("Example", "Values") fmt.Println(newHeader.Name) // TE fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewTEHeader is an example function for NewTEHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewTEHeader("compress, deflate;q=0.7") fmt.Println(header) }
Output:
func NewTKHeader ΒΆ added in v1.0.0
NewTKHeader creates a new Tk Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Tk
// Create a new Header instance. newHeader := goheader.NewTKHeader("Example", "Values") fmt.Println(newHeader.Name) // Tk fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewTKHeader is an example function for NewTKHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewTKHeader("T") fmt.Println(header) }
Output:
func NewTimingAllowOriginHeader ΒΆ added in v1.0.0
NewTimingAllowOriginHeader creates a new Timing-Allow-Origin Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Timing-Allow-Origin
// Create a new Header instance. newHeader := goheader.NewTimingAllowOriginHeader("Example", "Values") fmt.Println(newHeader.Name) // Timing-Allow-Origin fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewTimingAllowOriginHeader is an example function for NewTimingAllowOriginHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewTimingAllowOriginHeader("https://www.example.com") fmt.Println(header) }
Output:
func NewTrailerHeader ΒΆ added in v1.0.0
NewTrailerHeader creates a new Trailer Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Trailer
// Create a new Header instance. newHeader := goheader.NewTrailerHeader("Example", "Values") fmt.Println(newHeader.Name) // Trailer fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewTrailerHeader is an example function for NewTrailerHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewTrailerHeader("Expires") fmt.Println(header) }
Output:
func NewTransferEncodingHeader ΒΆ added in v1.0.0
NewTransferEncodingHeader creates a new Transfer-Encoding Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Transfer-Encoding
// Create a new Header instance. newHeader := goheader.NewTransferEncodingHeader("Example", "Values") fmt.Println(newHeader.Name) // Transfer-Encoding fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewTransferEncodingHeader is an example function for NewTransferEncodingHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewTransferEncodingHeader("gzip", "chunked") fmt.Println(header) }
Output:
func NewUpgradeHeader ΒΆ added in v1.0.0
NewUpgradeHeader creates a new Upgrade Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Upgrade
// Create a new Header instance. newHeader := goheader.NewUpgradeHeader("Example", "Values") fmt.Println(newHeader.Name) // Upgrade fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewUpgradeHeader is an example function for NewUpgradeHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewUpgradeHeader("example/1", "example/2") fmt.Println(header) }
Output:
func NewUpgradeInsecureRequestsHeader ΒΆ added in v1.0.0
NewUpgradeInsecureRequestsHeader creates a new Upgrade-Insecure-Requests Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Upgrade-Insecure-Requests
// Create a new Header instance. newHeader := goheader.NewUpgradeInsecureRequestsHeader("Example", "Values") fmt.Println(newHeader.Name) // Upgrade-Insecure-Requests fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewUpgradeInsecureRequestsHeader is an example function for NewUpgradeInsecureRequestsHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewUpgradeInsecureRequestsHeader("1") fmt.Println(header) }
Output:
func NewUserAgentHeader ΒΆ added in v1.0.0
NewUserAgentHeader creates a new User-Agent Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent
// Create a new Header instance. newHeader := goheader.NewUserAgentHeader("Example", "Values") fmt.Println(newHeader.Name) // User-Agent fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewUserAgentHeader is an example function for NewUserAgentHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. 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) }
Output:
func NewVaryHeader ΒΆ added in v1.0.0
NewVaryHeader creates a new Vary Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Vary
// Create a new Header instance. newHeader := goheader.NewVaryHeader("Example", "Values") fmt.Println(newHeader.Name) // Vary fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewVaryHeader is an example function for NewVaryHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewVaryHeader("Accept") fmt.Println(header) }
Output:
func NewViaHeader ΒΆ added in v1.0.0
NewViaHeader creates a new Via Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Via
// Create a new Header instance. newHeader := goheader.NewViaHeader("Example", "Values") fmt.Println(newHeader.Name) // Via fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewViaHeader is an example function for NewViaHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewViaHeader("HTTP/1.1 proxy.example.re", "1.1 edge_1") fmt.Println(header) }
Output:
func NewViewportWidthHeader ΒΆ added in v1.0.0
NewViewportWidthHeader creates a new Viewport-Width Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Viewport-Width
// Create a new Header instance. newHeader := goheader.NewViewportWidthHeader("Example", "Values") fmt.Println(newHeader.Name) // Viewport-Width fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewViewportWidthHeader is an example function for NewViewportWidthHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewViewportWidthHeader("320") fmt.Println(header) }
Output:
func NewWWWAuthenticateHeader ΒΆ added in v1.0.0
NewWWWAuthenticateHeader creates a new WWW-Authenticate Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/WWW-Authenticate
// Create a new Header instance. newHeader := goheader.NewWWWAuthenticateHeader("Example", "Values") fmt.Println(newHeader.Name) // WWW-Authenticate fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewWWWAuthenticateHeader is an example function for NewWWWAuthenticateHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewWWWAuthenticateHeader("Basic realm=\"Access to the staging site\", charset=\"UTF-8\"") fmt.Println(header) }
Output:
func NewWantDigestHeader ΒΆ added in v1.0.0
NewWantDigestHeader creates a new Want-Digest Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Want-Digest
// Create a new Header instance. newHeader := goheader.NewWantDigestHeader("Example", "Values") fmt.Println(newHeader.Name) // Want-Digest fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewWantDigestHeader is an example function for NewWantDigestHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewWantDigestHeader("SHA-512;q=0.3, sha-256;q=1, md5;q=0") fmt.Println(header) }
Output:
func NewWarningHeader ΒΆ added in v1.0.0
NewWarningHeader creates a new Warning Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Warning
// Create a new Header instance. newHeader := goheader.NewWarningHeader("Example", "Values") fmt.Println(newHeader.Name) // Warning fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewWarningHeader is an example function for NewWarningHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewWarningHeader("112 - \"cache down\" \"Wed, 21 Oct 2015 07:28:00 GMT\"") fmt.Println(header) }
Output:
func NewWidthHeader ΒΆ added in v1.0.0
NewWidthHeader creates a new Width Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Width
// Create a new Header instance. newHeader := goheader.NewWidthHeader("Example", "Values") fmt.Println(newHeader.Name) // Width fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewWidthHeader is an example function for NewWidthHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewWidthHeader("1920") fmt.Println(header) }
Output:
func NewXATTDeviceIDHeader ΒΆ added in v1.0.0
NewXATTDeviceIDHeader creates a new X-ATT-DeviceId Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-ATT-DeviceId
// Create a new Header instance. newHeader := goheader.NewXATTDeviceIDHeader("Example", "Values") fmt.Println(newHeader.Name) // X-ATT-DeviceId fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewXATTDeviceIDHeader is an example function for NewXATTDeviceIDHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewXATTDeviceIDHeader("GT-P7320/P7320XXLPG") fmt.Println(header) }
Output:
func NewXCSRFTokenHeader ΒΆ added in v1.0.0
NewXCSRFTokenHeader creates a new X-Csrf-Token Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Csrf-Token
// Create a new Header instance. newHeader := goheader.NewXCSRFTokenHeader("Example", "Values") fmt.Println(newHeader.Name) // X-Csrf-Token fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewXCSRFTokenHeader is an example function for NewXCSRFTokenHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewXCSRFTokenHeader("i8XNjC4b8KVok4uw5RftR38Wgp2BFwql") fmt.Println(header) }
Output:
func NewXContentDurationHeader ΒΆ added in v1.0.0
NewXContentDurationHeader creates a new X-Content-Duration Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Duration
// Create a new Header instance. newHeader := goheader.NewXContentDurationHeader("Example", "Values") fmt.Println(newHeader.Name) // X-Content-Duration fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewXContentDurationHeader is an example function for NewXContentDurationHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewXContentDurationHeader("42.666") fmt.Println(header) }
Output:
func NewXContentSecurityPolicyHeader ΒΆ added in v1.0.0
NewXContentSecurityPolicyHeader creates a new X-Content-Security-Policy Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Security-Policy
// Create a new Header instance. newHeader := goheader.NewXContentSecurityPolicyHeader("Example", "Values") fmt.Println(newHeader.Name) // X-Content-Security-Policy fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewXContentSecurityPolicyHeader is an example function for NewXContentSecurityPolicyHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewXContentSecurityPolicyHeader("default-src 'self'") fmt.Println(header) }
Output:
func NewXContentTypeOptionsHeader ΒΆ added in v1.0.0
NewXContentTypeOptionsHeader creates a new X-Content-Type-Options Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options
// Create a new Header instance. newHeader := goheader.NewXContentTypeOptionsHeader("Example", "Values") fmt.Println(newHeader.Name) // X-Content-Type-Options fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewXContentTypeOptionsHeader is an example function for NewXContentTypeOptionsHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewXContentTypeOptionsHeader("nosniff") fmt.Println(header) }
Output:
func NewXCorrelationIDHeader ΒΆ added in v1.0.0
NewXCorrelationIDHeader creates a new X-Correlation-ID Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Correlation-ID
// Create a new Header instance. newHeader := goheader.NewXCorrelationIDHeader("Example", "Values") fmt.Println(newHeader.Name) // X-Correlation-ID fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewXCorrelationIDHeader is an example function for NewXCorrelationIDHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewXCorrelationIDHeader("f058ebd6-02f7-4d3f-942e-904344e8cde5") fmt.Println(header) }
Output:
func NewXDNSPrefetchControlHeader ΒΆ added in v1.0.0
NewXDNSPrefetchControlHeader creates a new X-DNS-Prefetch-Control Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-DNS-Prefetch-Control
// Create a new Header instance. newHeader := goheader.NewXDNSPrefetchControlHeader("Example", "Values") fmt.Println(newHeader.Name) // X-DNS-Prefetch-Control fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewXDNSPrefetchControlHeader is an example function for NewXDNSPrefetchControlHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewXDNSPrefetchControlHeader("off") fmt.Println(header) }
Output:
func NewXForwardedForHeader ΒΆ added in v1.0.0
NewXForwardedForHeader creates a new X-Forwarded-For Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For
// Create a new Header instance. newHeader := goheader.NewXForwardedForHeader("Example", "Values") fmt.Println(newHeader.Name) // X-Forwarded-For fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewXForwardedForHeader is an example function for NewXForwardedForHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewXForwardedForHeader("203.0.113.195", "2001:db8:85a3:8d3:1319:8a2e:370:7348") fmt.Println(header) }
Output:
func NewXForwardedHostHeader ΒΆ added in v1.0.0
NewXForwardedHostHeader creates a new X-Forwarded-Host Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Host
// Create a new Header instance. newHeader := goheader.NewXForwardedHostHeader("Example", "Values") fmt.Println(newHeader.Name) // X-Forwarded-Host fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewXForwardedHostHeader is an example function for NewXForwardedHostHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewXForwardedHostHeader("id42.example-cdn.com") fmt.Println(header) }
Output:
func NewXForwardedProtoHeader ΒΆ added in v1.0.0
NewXForwardedProtoHeader creates a new X-Forwarded-Proto Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Proto
// Create a new Header instance. newHeader := goheader.NewXForwardedProtoHeader("Example", "Values") fmt.Println(newHeader.Name) // X-Forwarded-Proto fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewXForwardedProtoHeader is an example function for NewXForwardedProtoHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewXForwardedProtoHeader("https") fmt.Println(header) }
Output:
func NewXFrameOptionsHeader ΒΆ added in v1.0.0
NewXFrameOptionsHeader creates a new X-Frame-Options Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
// Create a new Header instance. newHeader := goheader.NewXFrameOptionsHeader("Example", "Values") fmt.Println(newHeader.Name) // X-Frame-Options fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewXFrameOptionsHeader is an example function for NewXFrameOptionsHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewXFrameOptionsHeader("SAMEORIGIN") fmt.Println(header) }
Output:
func NewXHTTPMethodOverrideHeader ΒΆ added in v1.0.0
NewXHTTPMethodOverrideHeader creates a new X-Http-Method-Override Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Http-Method-Override
// Create a new Header instance. newHeader := goheader.NewXHTTPMethodOverrideHeader("Example", "Values") fmt.Println(newHeader.Name) // X-Http-Method-Override fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewXHTTPMethodOverrideHeader is an example function for NewXHTTPMethodOverrideHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewXHTTPMethodOverrideHeader("DELETE") fmt.Println(header) }
Output:
func NewXPoweredByHeader ΒΆ added in v1.0.0
NewXPoweredByHeader creates a new X-Powered-By Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Powered-By
// Create a new Header instance. newHeader := goheader.NewXPoweredByHeader("Example", "Values") fmt.Println(newHeader.Name) // X-Powered-By fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewXPoweredByHeader is an example function for NewXPoweredByHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewXPoweredByHeader("PHP/5.4.0") fmt.Println(header) }
Output:
func NewXRedirectByHeader ΒΆ added in v1.0.0
NewXRedirectByHeader creates a new X-Redirect-By Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Redirect-By
// Create a new Header instance. newHeader := goheader.NewXRedirectByHeader("Example", "Values") fmt.Println(newHeader.Name) // X-Redirect-By fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewXRedirectByHeader is an example function for NewXRedirectByHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewXRedirectByHeader("WordPress") fmt.Println(header) }
Output:
func NewXRequestIDHeader ΒΆ added in v1.0.0
NewXRequestIDHeader creates a new X-Request-ID Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Request-ID
// Create a new Header instance. newHeader := goheader.NewXRequestIDHeader("Example", "Values") fmt.Println(newHeader.Name) // X-Request-ID fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewXRequestIDHeader is an example function for NewXRequestIDHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewXRequestIDHeader("f058ebd6-02f7-4d3f-942e-904344e8cde5") fmt.Println(header) }
Output:
func NewXRequestedWithHeader ΒΆ added in v1.0.0
NewXRequestedWithHeader creates a new X-Requested-With Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Requested-With
// Create a new Header instance. newHeader := goheader.NewXRequestedWithHeader("Example", "Values") fmt.Println(newHeader.Name) // X-Requested-With fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewXRequestedWithHeader is an example function for NewXRequestedWithHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewXRequestedWithHeader("XMLHttpRequest") fmt.Println(header) }
Output:
func NewXUACompatibleHeader ΒΆ added in v1.0.0
NewXUACompatibleHeader creates a new X-UA-Compatible Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-UA-Compatible
// Create a new Header instance. newHeader := goheader.NewXUACompatibleHeader("Example", "Values") fmt.Println(newHeader.Name) // X-UA-Compatible fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewXUACompatibleHeader is an example function for NewXUACompatibleHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewXUACompatibleHeader("IE=EmulateIE7") fmt.Println(header) }
Output:
func NewXUIDHHeader ΒΆ added in v1.0.0
NewXUIDHHeader creates a new X-UIDH Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-UIDH
// Create a new Header instance. newHeader := goheader.NewXUIDHHeader("Example", "Values") fmt.Println(newHeader.Name) // X-UIDH fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewXUIDHHeader is an example function for NewXUIDHHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewXUIDHHeader("...") fmt.Println(header) }
Output:
func NewXWapProfileHeader ΒΆ added in v1.0.0
NewXWapProfileHeader creates a new X-Wap-Profile Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Wap-Profile
// Create a new Header instance. newHeader := goheader.NewXWapProfileHeader("Example", "Values") fmt.Println(newHeader.Name) // X-Wap-Profile fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewXWapProfileHeader is an example function for NewXWapProfileHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewXWapProfileHeader("http://wap.samsungmobile.com/uaprof/SGH-I777.xml") fmt.Println(header) }
Output:
func NewXWebKitCSPHeader ΒΆ added in v1.0.0
NewXWebKitCSPHeader creates a new X-WebKit-CSP Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-WebKit-CSP
// Create a new Header instance. newHeader := goheader.NewXWebKitCSPHeader("Example", "Values") fmt.Println(newHeader.Name) // X-WebKit-CSP fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewXWebKitCSPHeader is an example function for NewXWebKitCSPHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewXWebKitCSPHeader("default-src 'self'") fmt.Println(header) }
Output:
func NewXXSSProtectionHeader ΒΆ added in v1.0.0
NewXXSSProtectionHeader creates a new X-XSS-Protection Header with the specified values. It accepts a variadic number of strings, where each value represents an item to be added to the Header. More information on the HTTP header can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection
// Create a new Header instance. newHeader := goheader.NewXXSSProtectionHeader("Example", "Values") fmt.Println(newHeader.Name) // X-XSS-Protection fmt.Println(newHeader.Value) // ["Example", "Value"]
Example ΒΆ
ExampleNewXXSSProtectionHeader is an example function for NewXXSSProtectionHeader.
package main import ( "fmt" "github.com/lindsaygelle/goheader" ) func main() { // Create a new goheader.Header instance. header := goheader.NewXXSSProtectionHeader("1; mode=block") fmt.Println(header) }
Output: