Skip to content

Commit 31ddb8d

Browse files
authored
Merge pull request #29 from guoye-zhang/field-names
Complete built-in field names
2 parents 67a2dc8 + d17b0cf commit 31ddb8d

File tree

3 files changed

+412
-9
lines changed

3 files changed

+412
-9
lines changed

Sources/HTTPTypes/HTTPFieldName.swift

Lines changed: 246 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,129 +112,358 @@ extension HTTPField.Name {
112112
static var path: Self { .init(rawName: ":path", canonicalName: ":path") }
113113
static var `protocol`: Self { .init(rawName: ":protocol", canonicalName: ":protocol") }
114114
static var status: Self { .init(rawName: ":status", canonicalName: ":status") }
115+
115116
/// Accept
117+
///
118+
/// https://www.rfc-editor.org/rfc/rfc9110.html
116119
public static var accept: Self { .init(rawName: "Accept", canonicalName: "accept") }
120+
117121
/// Accept-Encoding
122+
///
123+
/// https://www.rfc-editor.org/rfc/rfc9110.html
118124
public static var acceptEncoding: Self { .init(rawName: "Accept-Encoding", canonicalName: "accept-encoding") }
125+
119126
/// Accept-Language
127+
///
128+
/// https://www.rfc-editor.org/rfc/rfc9110.html
120129
public static var acceptLanguage: Self { .init(rawName: "Accept-Language", canonicalName: "accept-language") }
130+
121131
/// Accept-Ranges
132+
///
133+
/// https://www.rfc-editor.org/rfc/rfc9110.html
122134
public static var acceptRanges: Self { .init(rawName: "Accept-Ranges", canonicalName: "accept-ranges") }
135+
123136
/// Access-Control-Allow-Credentials
137+
///
138+
/// https://fetch.spec.whatwg.org/
124139
public static var accessControlAllowCredentials: Self { .init(rawName: "Access-Control-Allow-Credentials", canonicalName: "access-control-allow-credentials") }
140+
125141
/// Access-Control-Allow-Headers
142+
///
143+
/// https://fetch.spec.whatwg.org/
126144
public static var accessControlAllowHeaders: Self { .init(rawName: "Access-Control-Allow-Headers", canonicalName: "access-control-allow-headers") }
145+
127146
/// Access-Control-Allow-Methods
147+
///
148+
/// https://fetch.spec.whatwg.org/
128149
public static var accessControlAllowMethods: Self { .init(rawName: "Access-Control-Allow-Methods", canonicalName: "access-control-allow-methods") }
150+
129151
/// Access-Control-Allow-Origin
152+
///
153+
/// https://fetch.spec.whatwg.org/
130154
public static var accessControlAllowOrigin: Self { .init(rawName: "Access-Control-Allow-Origin", canonicalName: "access-control-allow-origin") }
155+
131156
/// Access-Control-Expose-Headers
157+
///
158+
/// https://fetch.spec.whatwg.org/
132159
public static var accessControlExposeHeaders: Self { .init(rawName: "Access-Control-Expose-Headers", canonicalName: "access-control-expose-headers") }
160+
133161
/// Access-Control-Max-Age
162+
///
163+
/// https://fetch.spec.whatwg.org/
134164
public static var accessControlMaxAge: Self { .init(rawName: "Access-Control-Max-Age", canonicalName: "access-control-max-age") }
165+
135166
/// Access-Control-Request-Headers
167+
///
168+
/// https://fetch.spec.whatwg.org/
136169
public static var accessControlRequestHeaders: Self { .init(rawName: "Access-Control-Request-Headers", canonicalName: "access-control-request-headers") }
170+
137171
/// Access-Control-Request-Method
172+
///
173+
/// https://fetch.spec.whatwg.org/
138174
public static var accessControlRequestMethod: Self { .init(rawName: "Access-Control-Request-Method", canonicalName: "access-control-request-method") }
175+
139176
/// Age
177+
///
178+
/// https://www.rfc-editor.org/rfc/rfc9111.html
140179
public static var age: Self { .init(rawName: "Age", canonicalName: "age") }
141-
/// Alt-Svc
142-
public static var altSvc: Self { .init(rawName: "Alt-Svc", canonicalName: "alt-svc") }
180+
181+
/// Allow
182+
///
183+
/// https://www.rfc-editor.org/rfc/rfc9110.html
184+
public static var allow: Self { .init(rawName: "Allow", canonicalName: "allow") }
185+
143186
/// Authentication-Info
187+
///
188+
/// https://www.rfc-editor.org/rfc/rfc9110.html
144189
public static var authenticationInfo: Self { .init(rawName: "Authentication-Info", canonicalName: "authentication-info") }
190+
145191
/// Authorization
192+
///
193+
/// https://www.rfc-editor.org/rfc/rfc9110.html
146194
public static var authorization: Self { .init(rawName: "Authorization", canonicalName: "authorization") }
195+
147196
/// Cache-Control
197+
///
198+
/// https://www.rfc-editor.org/rfc/rfc9111.html
148199
public static var cacheControl: Self { .init(rawName: "Cache-Control", canonicalName: "cache-control") }
200+
149201
/// Connection
202+
///
203+
/// https://www.rfc-editor.org/rfc/rfc9110.html
150204
public static var connection: Self { .init(rawName: "Connection", canonicalName: "connection") }
205+
151206
/// Content-Disposition
207+
///
208+
/// https://www.rfc-editor.org/rfc/rfc6266.html
152209
public static var contentDisposition: Self { .init(rawName: "Content-Disposition", canonicalName: "content-disposition") }
210+
153211
/// Content-Encoding
212+
///
213+
/// https://www.rfc-editor.org/rfc/rfc9110.html
154214
public static var contentEncoding: Self { .init(rawName: "Content-Encoding", canonicalName: "content-encoding") }
215+
216+
/// Content-Language
217+
///
218+
/// https://www.rfc-editor.org/rfc/rfc9110.html
219+
public static var contentLanguage: Self { .init(rawName: "Content-Language", canonicalName: "content-language") }
220+
155221
/// Content-Length
222+
///
223+
/// https://www.rfc-editor.org/rfc/rfc9110.html
156224
public static var contentLength: Self { .init(rawName: "Content-Length", canonicalName: "content-length") }
225+
226+
/// Content-Location
227+
///
228+
/// https://www.rfc-editor.org/rfc/rfc9110.html
229+
public static var contentLocation: Self { .init(rawName: "Content-Location", canonicalName: "content-location") }
230+
231+
/// Content-Range
232+
///
233+
/// https://www.rfc-editor.org/rfc/rfc9110.html
234+
public static var contentRange: Self { .init(rawName: "Content-Range", canonicalName: "content-range") }
235+
157236
/// Content-Security-Policy
237+
///
238+
/// https://www.w3.org/TR/CSP/
158239
public static var contentSecurityPolicy: Self { .init(rawName: "Content-Security-Policy", canonicalName: "content-security-policy") }
240+
241+
/// Content-Security-Policy-Report-Only
242+
///
243+
/// https://www.w3.org/TR/CSP/
244+
public static var contentSecurityPolicyReportOnly: Self { .init(rawName: "Content-Security-Policy-Report-Only", canonicalName: "content-security-policy-report-only") }
245+
159246
/// Content-Type
247+
///
248+
/// https://www.rfc-editor.org/rfc/rfc9110.html
160249
public static var contentType: Self { .init(rawName: "Content-Type", canonicalName: "content-type") }
250+
161251
/// Cookie
252+
///
253+
/// https://www.rfc-editor.org/rfc/rfc6265.html
162254
public static var cookie: Self { .init(rawName: "Cookie", canonicalName: "cookie") }
255+
256+
/// Cross-Origin-Resource-Policy
257+
///
258+
/// https://fetch.spec.whatwg.org/
259+
public static var crossOriginResourcePolicy: Self { .init(rawName: "Cross-Origin-Resource-Policy", canonicalName: "cross-origin-resource-policy") }
260+
163261
/// Date
262+
///
263+
/// https://www.rfc-editor.org/rfc/rfc9110.html
164264
public static var date: Self { .init(rawName: "Date", canonicalName: "date") }
265+
165266
/// Early-Data
267+
///
268+
/// https://www.rfc-editor.org/rfc/rfc8470.html
166269
public static var earlyData: Self { .init(rawName: "Early-Data", canonicalName: "early-data") }
270+
167271
/// ETag
272+
///
273+
/// https://www.rfc-editor.org/rfc/rfc9110.html
168274
public static var eTag: Self { .init(rawName: "ETag", canonicalName: "etag") }
275+
169276
/// Expect
277+
///
278+
/// https://www.rfc-editor.org/rfc/rfc9110.html
170279
public static var expect: Self { .init(rawName: "Expect", canonicalName: "expect") }
280+
171281
/// Expires
282+
///
283+
/// https://www.rfc-editor.org/rfc/rfc9111.html
172284
public static var expires: Self { .init(rawName: "Expires", canonicalName: "expires") }
173-
@available(*, unavailable, message: "Please use HTTPRequest.authority instead")
285+
286+
/// From
287+
///
288+
/// https://www.rfc-editor.org/rfc/rfc9110.html
289+
public static var from: Self { .init(rawName: "From", canonicalName: "from") }
290+
174291
/// Host
292+
///
293+
/// https://www.rfc-editor.org/rfc/rfc9110.html
294+
@available(*, unavailable, message: "Use HTTPRequest.authority instead")
175295
public static var host: Self { .init(rawName: "Host", canonicalName: "host") }
296+
297+
/// If-Match
298+
///
299+
/// https://www.rfc-editor.org/rfc/rfc9110.html
300+
public static var ifMatch: Self { .init(rawName: "If-Match", canonicalName: "if-match") }
301+
176302
/// If-Modified-Since
303+
///
304+
/// https://www.rfc-editor.org/rfc/rfc9110.html
177305
public static var ifModifiedSince: Self { .init(rawName: "If-Modified-Since", canonicalName: "if-modified-since") }
306+
178307
/// If-None-Match
308+
///
309+
/// https://www.rfc-editor.org/rfc/rfc9110.html
179310
public static var ifNoneMatch: Self { .init(rawName: "If-None-Match", canonicalName: "if-none-match") }
311+
180312
/// If-Range
313+
///
314+
/// https://www.rfc-editor.org/rfc/rfc9110.html
181315
public static var ifRange: Self { .init(rawName: "If-Range", canonicalName: "if-range") }
182-
/// Keep-Alive
183-
public static var keepAlive: Self { .init(rawName: "Keep-Alive", canonicalName: "keep-alive") }
316+
317+
/// If-Unmodified-Since
318+
///
319+
/// https://www.rfc-editor.org/rfc/rfc9110.html
320+
public static var ifUnmodifiedSince: Self { .init(rawName: "If-Unmodified-Since", canonicalName: "if-unmodified-since") }
321+
184322
/// Last-Modified
323+
///
324+
/// https://www.rfc-editor.org/rfc/rfc9110.html
185325
public static var lastModified: Self { .init(rawName: "Last-Modified", canonicalName: "last-modified") }
326+
186327
/// Location
328+
///
329+
/// https://www.rfc-editor.org/rfc/rfc9110.html
187330
public static var location: Self { .init(rawName: "Location", canonicalName: "location") }
331+
332+
/// Max-Forwards
333+
///
334+
/// https://www.rfc-editor.org/rfc/rfc9110.html
335+
public static var maxForwards: Self { .init(rawName: "Max-Forwards", canonicalName: "max-forwards") }
336+
188337
/// Origin
338+
///
339+
/// https://www.rfc-editor.org/rfc/rfc6454.html
189340
public static var origin: Self { .init(rawName: "Origin", canonicalName: "origin") }
341+
190342
/// Priority
343+
///
344+
/// https://www.rfc-editor.org/rfc/rfc9218.html
191345
public static var priority: Self { .init(rawName: "Priority", canonicalName: "priority") }
346+
192347
/// Proxy-Authenticate
348+
///
349+
/// https://www.rfc-editor.org/rfc/rfc9110.html
193350
public static var proxyAuthenticate: Self { .init(rawName: "Proxy-Authenticate", canonicalName: "proxy-authenticate") }
351+
194352
/// Proxy-Authentication-Info
353+
///
354+
/// https://www.rfc-editor.org/rfc/rfc9110.html
195355
public static var proxyAuthenticationInfo: Self { .init(rawName: "Proxy-Authentication-Info", canonicalName: "proxy-authentication-info") }
356+
196357
/// Proxy-Authorization
358+
///
359+
/// https://www.rfc-editor.org/rfc/rfc9110.html
197360
public static var proxyAuthorization: Self { .init(rawName: "Proxy-Authorization", canonicalName: "proxy-authorization") }
198-
/// Proxy-Connection
199-
public static var proxyConnection: Self { .init(rawName: "Proxy-Connection", canonicalName: "proxy-connection") }
361+
200362
/// Range
363+
///
364+
/// https://www.rfc-editor.org/rfc/rfc9110.html
201365
public static var range: Self { .init(rawName: "Range", canonicalName: "range") }
366+
202367
/// Referer
368+
///
369+
/// https://www.rfc-editor.org/rfc/rfc9110.html
203370
public static var referer: Self { .init(rawName: "Referer", canonicalName: "referer") }
371+
372+
/// Retry-After
373+
///
374+
/// https://www.rfc-editor.org/rfc/rfc9110.html
375+
public static var retryAfter: Self { .init(rawName: "Retry-After", canonicalName: "retry-after") }
376+
377+
/// Sec-Purpose
378+
///
379+
/// https://fetch.spec.whatwg.org/
380+
public static var secPurpose: Self { .init(rawName: "Sec-Purpose", canonicalName: "sec-purpose") }
381+
204382
/// Sec-WebSocket-Accept
383+
///
384+
/// https://www.rfc-editor.org/rfc/rfc6455.html
205385
public static var secWebSocketAccept: Self { .init(rawName: "Sec-WebSocket-Accept", canonicalName: "sec-websocket-accept") }
386+
206387
/// Sec-WebSocket-Extensions
388+
///
389+
/// https://www.rfc-editor.org/rfc/rfc6455.html
207390
public static var secWebSocketExtensions: Self { .init(rawName: "Sec-WebSocket-Extensions", canonicalName: "sec-websocket-extensions") }
391+
208392
/// Sec-WebSocket-Key
393+
///
394+
/// https://www.rfc-editor.org/rfc/rfc6455.html
209395
public static var secWebSocketKey: Self { .init(rawName: "Sec-WebSocket-Key", canonicalName: "sec-websocket-key") }
396+
210397
/// Sec-WebSocket-Protocol
398+
///
399+
/// https://www.rfc-editor.org/rfc/rfc6455.html
211400
public static var secWebSocketProtocol: Self { .init(rawName: "Sec-WebSocket-Protocol", canonicalName: "sec-websocket-protocol") }
401+
212402
/// Sec-WebSocket-Version
403+
///
404+
/// https://www.rfc-editor.org/rfc/rfc6455.html
213405
public static var secWebSocketVersion: Self { .init(rawName: "Sec-WebSocket-Version", canonicalName: "sec-websocket-version") }
406+
214407
/// Server
408+
///
409+
/// https://www.rfc-editor.org/rfc/rfc9110.html
215410
public static var server: Self { .init(rawName: "Server", canonicalName: "server") }
411+
216412
/// Set-Cookie
413+
///
414+
/// https://www.rfc-editor.org/rfc/rfc6265.html
217415
public static var setCookie: Self { .init(rawName: "Set-Cookie", canonicalName: "set-cookie") }
416+
218417
/// Strict-Transport-Security
418+
///
419+
/// https://www.rfc-editor.org/rfc/rfc6797.html
219420
public static var strictTransportSecurity: Self { .init(rawName: "Strict-Transport-Security", canonicalName: "strict-transport-security") }
421+
422+
/// TE
423+
///
424+
/// https://www.rfc-editor.org/rfc/rfc9110.html
425+
public static var te: Self { .init(rawName: "TE", canonicalName: "te") }
426+
220427
/// Trailer
428+
///
429+
/// https://www.rfc-editor.org/rfc/rfc9110.html
221430
public static var trailer: Self { .init(rawName: "Trailer", canonicalName: "trailer") }
431+
222432
/// Transfer-Encoding
433+
///
434+
/// https://www.rfc-editor.org/rfc/rfc9112.html
223435
public static var transferEncoding: Self { .init(rawName: "Transfer-Encoding", canonicalName: "transfer-encoding") }
436+
224437
/// Upgrade
438+
///
439+
/// https://www.rfc-editor.org/rfc/rfc9110.html
225440
public static var upgrade: Self { .init(rawName: "Upgrade", canonicalName: "upgrade") }
226-
/// Upgrade-Insecure-Requests
227-
public static var upgradeInsecureRequests: Self { .init(rawName: "Upgrade-Insecure-Requests", canonicalName: "upgrade-insecure-requests") }
441+
228442
/// User-Agent
443+
///
444+
/// https://www.rfc-editor.org/rfc/rfc9110.html
229445
public static var userAgent: Self { .init(rawName: "User-Agent", canonicalName: "user-agent") }
446+
230447
/// Vary
448+
///
449+
/// https://www.rfc-editor.org/rfc/rfc9110.html
231450
public static var vary: Self { .init(rawName: "Vary", canonicalName: "vary") }
451+
232452
/// Via
453+
///
454+
/// https://www.rfc-editor.org/rfc/rfc9110.html
233455
public static var via: Self { .init(rawName: "Via", canonicalName: "via") }
456+
234457
/// WWW-Authenticate
458+
///
459+
/// https://www.rfc-editor.org/rfc/rfc9110.html
235460
public static var wwwAuthenticate: Self { .init(rawName: "WWW-Authenticate", canonicalName: "www-authenticate") }
461+
236462
/// X-Content-Type-Options
463+
///
464+
/// https://fetch.spec.whatwg.org/
237465
public static var xContentTypeOptions: Self { .init(rawName: "X-Content-Type-Options", canonicalName: "x-content-type-options") }
466+
238467
// Deprecated
239468
/// P3P
240469
static var p3P: Self { .init(rawName: "P3P", canonicalName: "p3p") }
@@ -247,6 +476,14 @@ extension HTTPField.Name {
247476
/// X-XSS-Protection
248477
static var xXSSProtection: Self { .init(rawName: "X-XSS-Protection", canonicalName: "x-xss-protection") }
249478
// Internal
479+
/// Alt-Svc
480+
static var altSvc: Self { .init(rawName: "Alt-Svc", canonicalName: "alt-svc") }
481+
/// Keep-Alive
482+
static var keepAlive: Self { .init(rawName: "Keep-Alive", canonicalName: "keep-alive") }
483+
/// Proxy-Connection
484+
static var proxyConnection: Self { .init(rawName: "Proxy-Connection", canonicalName: "proxy-connection") }
485+
/// Upgrade-Insecure-Requests
486+
static var upgradeInsecureRequests: Self { .init(rawName: "Upgrade-Insecure-Requests", canonicalName: "upgrade-insecure-requests") }
250487
/// Datagram-Flow-Id
251488
static var datagramFlowId: Self { .init(rawName: "Datagram-Flow-Id", canonicalName: "datagram-flow-id") }
252489
/// Capsule-Protocol

0 commit comments

Comments
 (0)