git.sr.ht/~pingoo/stdx@v0.0.0-20240218134121-094174641f6e/httpx/const.go (about)

     1  package httpx
     2  
     3  const (
     4  	HeaderLastModified            = "Last-Modified"
     5  	HeaderContentType             = "Content-Type"
     6  	HeaderContentEncoding         = "Content-Encoding"
     7  	HeaderCacheControl            = "Cache-Control"
     8  	HeaderContentLength           = "Content-Length"
     9  	HeaderETag                    = "ETag"
    10  	HeaderServer                  = "Server"
    11  	HeaderIfModifiedSince         = "If-Modified-Since"
    12  	HeaderExpires                 = "Expires"
    13  	HeaderIfNoneMatch             = "If-None-Match"
    14  	HeaderAccept                  = "Accept"
    15  	HeaderUserAgent               = "User-Agent"
    16  	HeaderAuthorization           = "Authorization"
    17  	HeaderAltSvc                  = "Alt-Svc"
    18  	HeaderStrictTransportSecurity = "Strict-Transport-Security"
    19  	HeaderContentDisposition      = "Content-Disposition"
    20  	HeaderReferer                 = "Referer"
    21  	HeaderDoNotTrack              = "Dnt"
    22  	HeaderAcceptLanguage          = "Accept-Language"
    23  )
    24  
    25  // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
    26  // https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching
    27  const (
    28  	CacheControlNoCache = "private, no-cache, no-store, must-revalidate" // "no-cache, no-store, no-transform, must-revalidate, private, max-age=0"
    29  	CacheControlDynamic = "public, no-cache, must-revalidate"            // TODO https://web.dev/http-cache/, https://web.dev/love-your-cache/
    30  	// CacheControlDynamic    = "max-age=0, must-revalidate, public" // TODO https://web.dev/http-cache/, https://web.dev/love-your-cache/
    31  	// CacheControlNoCache       = "no-cache, no-store, no-transform, must-revalidate" // "no-cache, no-store, no-transform, must-revalidate, private, max-age=0"
    32  	CacheControl30Seconds = "public, max-age=30, must-revalidate"
    33  	CacheControl1Minute   = "public, max-age=60, must-revalidate"
    34  	CacheControl5Minutes  = "public, max-age=300, stale-while-revalidate=30"
    35  	CacheControl10Minutes = "public, max-age=600, stale-while-revalidate=60"
    36  	CacheControl15Minutes = "public, max-age=900, stale-while-revalidate=90"
    37  	CacheControl30Minutes = "public, max-age=1800, stale-while-revalidate=180"
    38  	CacheControl1Hour     = "public, max-age=3600, stale-while-revalidate=360"
    39  	CacheControl1Day      = "public, max-age=86400, stale-while-revalidate=600"
    40  	CacheControl1Week     = "public, max-age=604800, stale-while-revalidate=600"
    41  	CacheControl1Month    = "public, max-age=2592000, stale-while-revalidate=600"
    42  	CacheControlImmutable = "public, max-age=31536000, immutable"
    43  )
    44  
    45  const (
    46  	CacheControl30SecondsCdnOnly = "public, max-age=0, s-max-age=30, must-revalidate"
    47  )
    48  
    49  const (
    50  	MediaTypeText = "text/plain"
    51  	MediaTypeXml  = "application/xml"
    52  	MediaTypeJson = "application/json"
    53  
    54  	MediaTypeHtmlUtf8 = "text/html; charset=utf-8"
    55  	MediaTypeTextUtf8 = "text/plain; charset=utf-8"
    56  
    57  	MediaTypeJsonFeed = "application/feed+json"
    58  	MediaTypeRSS      = "application/rss+xml"
    59  	MediaTypeAtom     = "application/atom+xml"
    60  
    61  	MediaTypeAudio = "audio"
    62  	MediaTypeVideo = "video"
    63  	MediaTypePNG   = "image/png"
    64  	MediaTypeJPEG  = "image/jpeg"
    65  	MediaTypeSVG   = "image/svg+xml"
    66  
    67  	// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
    68  	// alternative value from the 'file' command line program: text/x-shellscript
    69  	MediaTypeShellScript = "application/x-sh"
    70  )