Documentation
¶
Index ¶
Constants ¶
View Source
const ( // CacheControl // Used to specify directives that must be obeyed by all caching mechanisms along the request-response chain. // // Cache-Control: no-cache CacheControl = "Cache-Control" // Connection // Control options for the current connection and list of hop-by-hop request fields. Must not be used with HTTP/2. // // Connection: keep-alive // Connection: Upgrade Connection = "Connection" // ContentEncoding // The type of encoding used on the data. See HTTP compression. // // Content-Encoding: gzip ContentEncoding = "Content-Encoding" // ContentLength // The length of the request body in octets (8-bit bytes). // // Content-Length: 348 ContentLength = "Content-Length" // ContentMd5 // A Base64-encoded binary MD5 sum of the content of the request body. // // Content-MD5: Q2hlY2sgSW50ZWdyaXR5IQ== ContentMd5 = "Content-MD5" // ContentType // The Media type of the body of the request (used with POST and PUT s). // // Content-Type: application/x-www-form-urlencoded ContentType = "Content-Type" // Date // The date and time at which the message was originated (in "HTTP-date" bind as defined by RFC 7231 Date/Time Formats). // // Date: Tue, 15 Nov 1994 08:12:31 GMT Date = "Date" // Pragma // Implementation-specific fields that may have various effects anywhere along the request-response chain. // // Pragma: no-cache Pragma = "Pragma" // Trailer // The Trailer general field value indicates that the given set of header fields is present in the trailer of a message encoded with chunked transfer coding. // // Trailer: Max-Forwards Trailer = "Trailer" // TransferEncoding // The form of encoding used to safely transfer the entity to the user. Currently defined methods are: chunked, compress, deflate, gzip, identity. Must not be used with HTTP/2. // // Transfer-Encoding: chunked TransferEncoding = "Transfer-Encoding" // Upgrade // Ask the server to upgrade to another protocol. Must not be used in HTTP/2. // // Upgrade: h2c, HTTPS/1.3, IRC/6.9, RTA/x11, websocket Upgrade = "Upgrade" // Via // Informs the server of proxies through which the request was sent. // // Via: 1.0 fred, 1.1 example.com (Apache/1.1) Via = "Via" // Warning // A general warning about possible problems with the entity body. // // Warning: 199 Miscellaneous warning Warning = "Warning" )
Request and Response Headers https://en.wikipedia.org/wiki/List_of_HTTP_header_fields
View Source
const ( // RequestAIm // Acceptable instance-manipulations for the request. // // A-IM: feed RequestAIm = "A-IM" // RequestAccept // Media type(s) that is/are acceptable for the response. See Content negotiation. // // Accept: text/html RequestAccept = "Accept" // RequestAcceptCharset // Character sets that are acceptable. // // Accept-Charset: utf-8 RequestAcceptCharset = "Accept-Charset" // RequestAcceptDatetime // Acceptable version in time. // // Accept-Datetime: Thu, 31 May 2007 20:35:00 GMT RequestAcceptDatetime = "Accept-Datetime" // RequestAcceptEncoding // List of acceptable encodings. See HTTP compression. // // Accept-Encoding: gzip, deflate RequestAcceptEncoding = "Accept-Encoding" // RequestAcceptLanguage // List of acceptable human languages for response. See Content negotiation. // // Accept-Language: en-US RequestAcceptLanguage = "Accept-Language" // RequestAccessControlRequestMethod // Initiates a request for cross-origin resource sharing with Origin (below). // // Access-Control-Request-Method: GET RequestAccessControlRequestMethod = "Access-Control-Request-Method" // RequestAccessControlRequests // Initiates a request for cross-origin resource sharing with Origin (below). //Access-Control-Request-Method: GET RequestAccessControlRequests = "Access-Control-Request-Headers" // RequestAuthorization // Authentication credentials for HTTP authentication. // // Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== RequestAuthorization = "Authorization" // RequestCookie // An HTTP cookie previously sent by the server with Set-Cookie (below). // // Cookie: $Version=1; Skin=new; RequestCookie = "Cookie" // RequestExpect // Indicates that particular server behaviors are required by the client. // // Expect: 100-continue RequestExpect = "Expect" // RequestForwarded // Disclose original information of a client connecting to a web server through an HTTP proxy. // // Forwarded: for=192.0.2.60;proto=http;by=203.0.113.43 // Forwarded: for=192.0.2.43, for=198.51.100.17 RequestForwarded = "Forwarded" // RequestFrom // The email address of the user making the request. // // From: user@example.com RequestFrom = "From" // RequestHost // The domain name of the server (for virtual hosting), and the TCP port number on which the server is listening. The port number may be omitted if the port is the standard port for the service requested. Mandatory since HTTP/1.1. If the request is generated directly in HTTP/2, it should not be used. // // Host: en.wikipedia.org:8080 // Host: en.wikipedia.org RequestHost = "Host" // RequestHttp2Settings // A request that upgrades from HTTP/1.1 to HTTP/2 MUST include exactly one HTTP2-Setting header field. The HTTP2-Settings header field is a connection-specific header field that includes parameters that govern the HTTP/2 connection, provided in anticipation of the server accepting the request to upgrade. // // HTTP2-Settings: token64 RequestHttp2Settings = "HTTP2-Settings" // RequestIfMatch // Only perform the action if the client supplied entity matches the same entity on the server. This is mainly for methods like PUT to only update a resource if it has not been modified since the user last updated it. // // If-Match: "737060cd8c284d8af7ad3082f209582d" RequestIfMatch = "If-Match" // RequestIfModifiedSince // Allows a 304 Not Modified to be returned if content is unchanged. // // If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT RequestIfModifiedSince = "If-Modified-Since" // RequestIfNoneMatch // Allows a 304 Not Modified to be returned if content is unchanged, see HTTP ETag. // // If-None-Match: "737060cd8c284d8af7ad3082f209582d" RequestIfNoneMatch = "If-None-Match" // RequestIfRange // If the entity is unchanged, send me the part(s) that I am missing; otherwise, send me the entire new entity. // // If-Range: "737060cd8c284d8af7ad3082f209582d" RequestIfRange = "If-Range" // RequestIfUnmodifiedSince // Only send the response if the entity has not been modified since a specific time. // // If-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMT RequestIfUnmodifiedSince = "If-Unmodified-Since" // RequestMaxForwards // Limit the number of times the message can be forwarded through proxies or gateways. // // Max-Forwards: 10 RequestMaxForwards = "Max-Forwards" // RequestOrigin // Initiates a request for cross-origin resource sharing (asks server for Access-Control-* response fields). // // Origin: http://www.example-social-network.com RequestOrigin = "Origin" // RequestPrefer // Allows client to request that certain behaviors be employed by a server while processing a request. // // Prefer: return=representation RequestPrefer = "Prefer" // RequestProxyAuthorization // Authorization credentials for connecting to a proxy. // // Proxy-Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== RequestProxyAuthorization = "Proxy-Authorization" // RequestRange // Request only part of an entity. ToBytes are numbered from 0. See Byte serving. // // Range: bytes=500-999 RequestRange = "Range" // RequestReferer // This is the address of the previous web page from which a link to the currently requested page was followed. (The word "referrer" has been misspelled in the RFC as well as in most implementations to the point that it has become standard usage and is considered correct terminology) // // Referer: http://en.wikipedia.org/wiki/Main_Page RequestReferer = "Referer" // RequestTe // The transfer encodings the user agent is willing to accept: the same values as for the response header field Transfer-Encoding can be used, plus the "trailers" value (related to the "chunked" transfer method) to notify the server it expects to receive additional fields in the trailer after the last, zero-sized, chunk. Only trailers is supported in HTTP/2. // // TE: trailers, deflate RequestTe = "TE" // RequestUserAgent // The user agent string of the user agent. // // User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20100101 Firefox/12.0 RequestUserAgent = "User-Agent" )
Request Headers https://en.wikipedia.org/wiki/List_of_HTTP_header_fields
View Source
const ( // ResponseAcceptCh // Requests HTTP Client Hints // // Accept-CH: UA, Platform ResponseAcceptCh = "Accept-CH" // ResponseAccessControlAllowOrigin // Specifying which web sites can participate in cross-origin resource sharing // // Access-Control-Allow-Origin: * ResponseAccessControlAllowOrigin = "Access-Control-Allow-Origin" // ResponseAccessControlAllowCredentials // Specifying which web sites can participate in cross-origin resource sharing //Access-Control-Allow-Origin: * ResponseAccessControlAllowCredentials = "Access-Control-Allow-Credentials" // ResponseAccessControlExposeHeaders // Specifying which web sites can participate in cross-origin resource sharing //Access-Control-Allow-Origin: * ResponseAccessControlExposeHeaders = "Access-Control-Expose-Headers" // ResponseAccessControlMaxAge // Specifying which web sites can participate in cross-origin resource sharing //Access-Control-Allow-Origin: * ResponseAccessControlMaxAge = "Access-Control-Max-Age" // ResponseAccessControlAllowMethods // Specifying which web sites can participate in cross-origin resource sharing //Access-Control-Allow-Origin: * ResponseAccessControlAllowMethods = "Access-Control-Allow-Methods" // ResponseAccessControlAllowHeaders // Specifying which web sites can participate in cross-origin resource sharing //Access-Control-Allow-Origin: * ResponseAccessControlAllowHeaders = "Access-Control-Allow-Headers" // ResponseAcceptPatch // Specifies which patch document formats this server supports // // Accept-Patch: text/example;charset=utf-8 ResponseAcceptPatch = "Accept-Patch" // ResponseAcceptRanges // What partial content range types this server supports via byte serving // // Accept-Ranges: bytes ResponseAcceptRanges = "Accept-Ranges" // ResponseAge // The age the object has been in a proxy cache in seconds // // Age: 12 ResponseAge = "Age" // ResponseAllow // Valid methods for a specified resource. To be used for a 405 Method not allowed // // Allow: GET, HEAD ResponseAllow = "Allow" // ResponseAltSvc // A server uses "Alt-Svc" header (meaning Alternative Services) to indicate that its resources can also be accessed at a different network location (host or port) or using a different protocol When using HTTP/2, servers should instead send an ALTSVC frame. // // Alt-Svc: http/1.1="http2.example.com:8001"; ma=7200 ResponseAltSvc = "Alt-Svc" // ResponseContentDisposition // An opportunity to raise a "File Download" dialogue box for a known MIME type with binary bind or suggest a filename for dynamic content. Quotes are necessary with special characters. // // Content-Disposition: attachment; filename="fname.ext" ResponseContentDisposition = "Content-Disposition" // ResponseContentLanguage // The natural language or languages of the intended audience for the enclosed content // // Content-Language: da ResponseContentLanguage = "Content-Language" // ResponseContentLocation // An alternate location for the returned data // // Content-Location: /index.htm ResponseContentLocation = "Content-Location" // ResponseContentRange // Where in a full body message this partial message belongs // // Content-Range: bytes 21010-47021/47022 ResponseContentRange = "Content-Range" // ResponseDeltaBase // Specifies the delta-encoding entity tag of the response. // // Delta-Base: "abc" ResponseDeltaBase = "Delta-Base" // ResponseEtag // An identifier for a specific version of a resource, often a message digest // // ETag: "737060cd8c284d8af7ad3082f209582d" ResponseEtag = "ETag" // ResponseExpires // Gives the date/time after which the response is considered stale (in "HTTP-date" bind as defined by RFC 7231) // // Expires: Thu, 01 Dec 1994 16:00:00 GMT ResponseExpires = "Expires" // ResponseIm // Instance-manipulations applied to the response. // // IM: feed ResponseIm = "IM" // ResponseLastModified // The last modified date for the requested object (in "HTTP-date" bind as defined by RFC 7231) // // Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT ResponseLastModified = "Last-Modified" // ResponseLink // Used to express a typed relationship with another resource, where the relation type is defined by RFC 5988 // // Link: </feed>; rel="alternate" ResponseLink = "Link" // ResponseLocation // Used in redirection, or when a new resource has been created. // Example 1: // Location: http://www.w3.org/pub/WWW/People.html Example 2: // Location: /pub/WWW/People.html ResponseLocation = "Location" // ResponseP3p // This field is supposed to set P3P policy, in the form of P3P:CP="your_compact_policy". However, P3P did not take off, most browsers have never fully implemented it, a lot of websites set this field with fake policy text, that was enough to fool browsers the existence of P3P policy and grant permissions for third party cookies. // // P3P: CP="This is not a // P3P policy! See https://en.wikipedia.org/wiki/Special:CentralAutoLogin/ // P3P for more info." ResponseP3p = "P3P" // ResponsePreferenceApplied // Indicates which Prefer tokens were honored by the server and applied to the processing of the request. // // Preference-Applied: return=representation ResponsePreferenceApplied = "Preference-Applied" // ResponseProxyAuthenticate // Request authentication to access the proxy. // // Proxy-Authenticate: Basic ResponseProxyAuthenticate = "Proxy-Authenticate" // ResponsePublicKeyPins // HTTP Public Key Pinning, announces hash of website's authentic TLS certificate // // Public-Key-Pins: max-age=2592000; pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="; ResponsePublicKeyPins = "Public-Key-Pins" // ResponseRetryAfter // If an entity is temporarily unavailable, this instructs the client to try again later. Value could be a specified period of time (in seconds) or a HTTP-date. // Example 1: // Retry-After: 120 Example 2: // Retry-After: Fri, 07 Nov 2014 23:59:59 GMT ResponseRetryAfter = "Retry-After" // ResponseServer // A name for the server // // Server: Apache/2.4.1 (Unix) ResponseServer = "Server" // ResponseSetCookie // An HTTP cookie // // Set-Cookie: UserID=JohnDoe; Max-Age=3600; Version=1 ResponseSetCookie = "Set-Cookie" // ResponseStrictTransportSecurity // A HSTS Policy informing the HTTP client how long to cache the HTTPS only policy and whether this applies to subdomains. // // Strict-Transport-Security: max-age=16070400; includeSubDomains ResponseStrictTransportSecurity = "Strict-Transport-Security" // ResponseTk // Tracking Status header, value suggested to be sent in response to a DNT(do-not-track), possible values: "!" — under construction "?" — dynamic "G" — gateway to multiple parties "N" — not tracking "T" — tracking "C" — tracking with consent "P" — tracking only if consented "D" — disregarding DNT "U" — updated // // Tk: ? ResponseTk = "Tk" // ResponseVary // Tells downstream proxies how to match future request headers to decide whether the cached response can be used rather than requesting a fresh one from the origin server. // Example 1: // Vary: * Example 2: // Vary: Accept-Language ResponseVary = "Vary" // ResponseWwwAuthenticate // Indicates the authentication scheme that should be used to access the requested entity. // // WWW-Authenticate: Basic ResponseWwwAuthenticate = "WWW-Authenticate" // ResponseXFrameOptions // Clickjacking protection: deny - no rendering within a frame, sameorigin - no rendering if origin mismatch, allow-from - allow from specified location, allowall - non-standard, allow from any location // // X-Frame-Options: deny ResponseXFrameOptions = "X-Frame-Options" )
Response Headers https://en.wikipedia.org/wiki/List_of_HTTP_header_fields
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.