|
| 1 | +/** |
| 2 | + * A list of well-known headers as published on Wikipedia. |
| 3 | + * @see https://en.wikipedia.org/wiki/List_of_HTTP_header_fields |
| 4 | + * |
| 5 | + * TODO Finish documenting each enum item and make sure to also include |
| 6 | + * the examples provided on the linked Wikipedia page above. The first |
| 7 | + * few headers are documented this way but we need all of them like that. |
| 8 | + * |
| 9 | + * TODO Ensure that there are no typos in the header names. |
| 10 | + */ |
| 11 | +export enum HttpHeader { |
| 12 | + // Standard request fields |
| 13 | + |
| 14 | + /** |
| 15 | + * Acceptable instance-manipulations for the request. |
| 16 | + * @example A-IM: feed |
| 17 | + * @see https://datatracker.ietf.org/doc/html/rfc3229 |
| 18 | + */ |
| 19 | + A_IM = "A-IM", |
| 20 | + /** |
| 21 | + * Media type(s) that is/are acceptable for the response. See Content negotiation. |
| 22 | + * @example Accept: text/html |
| 23 | + * @see https://datatracker.ietf.org/doc/html/rfc9110 |
| 24 | + */ |
| 25 | + Accept = "Accept", |
| 26 | + /** |
| 27 | + * Character sets that are acceptable. |
| 28 | + * @example Accept-Charset: utf-8 |
| 29 | + * @see https://datatracker.ietf.org/doc/html/rfc9110 |
| 30 | + */ |
| 31 | + AcceptCharset = "Accept-Charset", |
| 32 | + /** |
| 33 | + * Acceptable version in time. |
| 34 | + * @example Accept-Datetime: Thu, 31 May 2007 20:35:00 GMT |
| 35 | + * @see https://datatracker.ietf.org/doc/html/rfc7089 |
| 36 | + */ |
| 37 | + AcceptDatetime = "Accept-Datetime", |
| 38 | + AcceptEncoding = "Accept-Encoding", |
| 39 | + AcceptLanguage = "Accept-Language", |
| 40 | + AccessControlAllowOrigin = "Access-Control-Allow-Origin", |
| 41 | + AccessControlAllowCredentials = "Access-Control-Allow-Credentials", |
| 42 | + AccessControlExposeHeaders = "Access-Control-Expose-Headers", |
| 43 | + AccessControlMaxAge = "Access-Control-Max-Age", |
| 44 | + AccessControlAllowMethods = "Access-Control-Allow-Methods", |
| 45 | + AccessControlAllowHeaders = "Access-Control-Allow-Headers", |
| 46 | + Authorization = "Authorization", |
| 47 | + CacheControl = "Cache-Control", |
| 48 | + Connection = "Connection", |
| 49 | + ContentDisposition = "Content-Disposition", |
| 50 | + ContentEncoding = "Content-Encoding", |
| 51 | + ContentLength = "Content-Length", |
| 52 | + ContentLocation = "Content-Location", |
| 53 | + ContentMD5 = "Content-MD5", |
| 54 | + ContentType = "Content-Type", |
| 55 | + Cookie = "Cookie", |
| 56 | + Date = "Date", |
| 57 | + Expect = "Expect", |
| 58 | + Forwarded = "Forwarded", |
| 59 | + From = "From", |
| 60 | + Host = "Host", |
| 61 | + IfMatch = "If-Match", |
| 62 | + IfModifiedSince = "If-Modified-Since", |
| 63 | + IfNoneMatch = "If-None-Match", |
| 64 | + IfRange = "If-Range", |
| 65 | + IfUnmodifiedSince = "If-Unmodified-Since", |
| 66 | + MaxForwards = "Max-Forwards", |
| 67 | + Origin = "Origin", |
| 68 | + Pragma = "Pragma", |
| 69 | + Prefer = "Prefer", |
| 70 | + ProxyAuthorization = "Proxy-Authorization", |
| 71 | + Range = "Range", |
| 72 | + Referer = "Referer", |
| 73 | + TE = "TE", |
| 74 | + Trailer = "Trailer", |
| 75 | + TransferEncoding = "Transfer-Encoding", |
| 76 | + Upgrade = "Upgrade", |
| 77 | + UserAgent = "User-Agent", |
| 78 | + |
| 79 | + // Common non-standard request fields |
| 80 | + UpgradeInsecureRequests = "Upgrade-Insecure-Requests", |
| 81 | + XRequestedWith = "X-Requested-With", |
| 82 | + DNT = "DNT", |
| 83 | + XForwardedFor = "X-Forwarded-For", |
| 84 | + XForwardedHost = "X-Forwarded-Host", |
| 85 | + XForwardedProto = "X-Forwarded-Proto", |
| 86 | + FrontEndHttps = "Front-End-Https", |
| 87 | + XHttpMethodOverride = "X-Http-Method-Override", |
| 88 | + XAttDeviceId = "X-Att-DeviceId", |
| 89 | + XWapProfile = "X-Wap-Profile", |
| 90 | + ProxyConnection = "Proxy-Connection", |
| 91 | + XUIDH = "X-UIDH", |
| 92 | + XCsrfToken = "X-Csrf-Token", |
| 93 | + XRequestId = "X-Request-ID", // Alternative X-Request-Id |
| 94 | + CorrelationId = "X-Correlation-ID", // Alternative Correlation-ID |
| 95 | + SaveData = "Save-Data", |
| 96 | + SecGpc = "Sec-GPC", |
| 97 | + |
| 98 | + // Standard response fields |
| 99 | + AcceptCH = "Accept-CH", |
| 100 | + AcceptPatch = "Accept-Patch", |
| 101 | + AltSvc = "Alt-Svc", |
| 102 | + Age = "Age", |
| 103 | + Allow = "Allow", |
| 104 | + Expires = "Expires", |
| 105 | + IM = "IM", |
| 106 | + LastModified = "Last-Modified", |
| 107 | + Link = "Link", |
| 108 | + Location = "Location", |
| 109 | + P3P = "P3P", |
| 110 | + ProxyAuthenticate = "Proxy-Authenticate", |
| 111 | + PublicKeyPins = "Public-Key-Pins", |
| 112 | + /** |
| 113 | + * f an entity is temporarily unavailable, this instructs the client |
| 114 | + * to try again later. Value could be a specified period of time |
| 115 | + * (in seconds) or a HTTP-date. |
| 116 | + * |
| 117 | + * There are two accepted formats when it comes to the values of the header: |
| 118 | + * ```http |
| 119 | + * Retry-After: <http-date> |
| 120 | + * Retry-After: <delay-seconds> |
| 121 | + * ``` |
| 122 | + * |
| 123 | + * `<http-date>` |
| 124 | + * A date after which to retry. See the Date header for more details on the HTTP date format. |
| 125 | + * |
| 126 | + * `<delay-seconds>` |
| 127 | + * A non-negative decimal integer indicating the seconds to delay after the response is received. |
| 128 | + * |
| 129 | + * @example Retry-After: 120 |
| 130 | + * @example Retry-After: Fri, 07 Nov 2014 23:59:59 GMT |
| 131 | + * |
| 132 | + * @see https://datatracker.ietf.org/doc/html/rfc9110#section-10.2.3 |
| 133 | + */ |
| 134 | + RetryAfter = "Retry-After", |
| 135 | + Server = "Server", |
| 136 | + SetCookie = "Set-Cookie", |
| 137 | + StrictTransportSecurity = "Strict-Transport-Security", |
| 138 | + Tk = "Tk", |
| 139 | + Vary = "Vary", |
| 140 | + Via = "Via", // Same as request field |
| 141 | + /** |
| 142 | + * Indicates the authentication scheme that should be used to access the requested entity. |
| 143 | + * @example WWW-Authenticate: Basic |
| 144 | + * @see https://datatracker.ietf.org/doc/html/rfc9110 |
| 145 | + */ |
| 146 | + WWWAuthenticate = "WWW-Authenticate", |
| 147 | + XFrameOptions = "X-Frame-Options", |
| 148 | + |
| 149 | + // Common non-standard response fields |
| 150 | + ContentSecurityPolicy = "Content-Security-Policy", |
| 151 | + ExpectCT = "Expect-CT", |
| 152 | + NEL = "NEL", |
| 153 | + PermissionsPolicy = "Permissions-Policy", |
| 154 | + Refresh = "Refresh", |
| 155 | + ReportTo = "Report-To", |
| 156 | + Timing_Allow_Origin = "Timing-Allow-Origin", |
| 157 | +} |
0 commit comments