Skip to content

Commit 4c6954c

Browse files

File tree

3 files changed

+196
-42
lines changed

3 files changed

+196
-42
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Version 22
44

5+
### v22.4.2
6+
7+
- Excluded 41 response-only headers from the list of well-known ones used to depict request params in Documentation.
8+
59
### v22.4.1
610

711
- Fixed a bug that could lead to duplicate properties in generated client types:

src/well-known-headers.json

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,11 @@
88
"accept-encoding",
99
"accept-features",
1010
"accept-language",
11-
"accept-patch",
12-
"accept-post",
13-
"accept-ranges",
1411
"accept-signature",
1512
"access-control",
16-
"access-control-allow-credentials",
17-
"access-control-allow-headers",
18-
"access-control-allow-methods",
19-
"access-control-allow-origin",
20-
"access-control-expose-headers",
21-
"access-control-max-age",
2213
"access-control-request-headers",
2314
"access-control-request-method",
24-
"age",
25-
"allow",
2615
"alpn",
27-
"alt-svc",
2816
"alt-used",
2917
"alternates",
3018
"amp-cache-transform",
@@ -39,15 +27,11 @@
3927
"c-pep",
4028
"c-pep-info",
4129
"cache-control",
42-
"cache-status",
4330
"cal-managed-id",
4431
"caldav-timezones",
4532
"capsule-protocol",
46-
"cdn-cache-control",
47-
"cdn-loop",
4833
"cert-not-after",
4934
"cert-not-before",
50-
"clear-site-data",
5135
"client-cert",
5236
"client-cert-chain",
5337
"close",
@@ -60,7 +44,6 @@
6044
"concealed-auth-export",
6145
"configuration-context",
6246
"connection",
63-
"content-base",
6447
"content-digest",
6548
"content-disposition",
6649
"content-encoding",
@@ -71,11 +54,7 @@
7154
"content-md5",
7255
"content-range",
7356
"content-script-type",
74-
"content-security-policy",
75-
"content-security-policy-report-only",
76-
"content-style-type",
7757
"content-type",
78-
"content-version",
7958
"cookie",
8059
"cookie2",
8160
"cross-origin-embedder-policy",
@@ -100,10 +79,8 @@
10079
"dpop-nonce",
10180
"early-data",
10281
"ediint-features",
103-
"etag",
10482
"expect",
10583
"expect-ct",
106-
"expires",
10784
"ext",
10885
"forwarded",
10986
"from",
@@ -124,10 +101,8 @@
124101
"keep-alive",
125102
"label",
126103
"last-event-id",
127-
"last-modified",
128104
"link",
129105
"link-template",
130-
"location",
131106
"lock-token",
132107
"man",
133108
"max-forwards",
@@ -143,7 +118,6 @@
143118
"odata-maxversion",
144119
"odata-version",
145120
"opt",
146-
"optional-www-authenticate",
147121
"ordering-type",
148122
"origin",
149123
"origin-agent-cluster",
@@ -167,12 +141,9 @@
167141
"protocol-info",
168142
"protocol-query",
169143
"protocol-request",
170-
"proxy-authenticate",
171-
"proxy-authentication-info",
172144
"proxy-authorization",
173145
"proxy-features",
174146
"proxy-instruction",
175-
"proxy-status",
176147
"public",
177148
"public-key-pins",
178149
"public-key-pins-report-only",
@@ -181,45 +152,35 @@
181152
"referer",
182153
"referer-root",
183154
"referrer-policy",
184-
"refresh",
185155
"repeatability-client-id",
186156
"repeatability-first-sent",
187157
"repeatability-request-id",
188158
"repeatability-result",
189159
"replay-nonce",
190160
"reporting-endpoints",
191161
"repr-digest",
192-
"retry-after",
193162
"safe",
194163
"schedule-reply",
195164
"schedule-tag",
196165
"sec-gpc",
197166
"sec-purpose",
198167
"sec-token-binding",
199-
"sec-websocket-accept",
200168
"sec-websocket-extensions",
201169
"sec-websocket-key",
202170
"sec-websocket-protocol",
203171
"sec-websocket-version",
204172
"security-scheme",
205-
"server",
206-
"server-timing",
207-
"set-cookie",
208-
"set-cookie2",
209173
"setprofile",
210174
"signature",
211175
"signature-input",
212176
"slug",
213177
"soapaction",
214178
"status-uri",
215-
"strict-transport-security",
216179
"sunset",
217180
"surrogate-capability",
218-
"surrogate-control",
219181
"tcn",
220182
"te",
221183
"timeout",
222-
"timing-allow-origin",
223184
"topic",
224185
"traceparent",
225186
"tracestate",
@@ -232,13 +193,11 @@
232193
"use-as-dictionary",
233194
"user-agent",
234195
"variant-vary",
235-
"vary",
236196
"via",
237197
"want-content-digest",
238198
"want-digest",
239199
"want-repr-digest",
240200
"warning",
241-
"www-authenticate",
242201
"x-content-type-options",
243202
"x-frame-options"
244203
]

tools/headers.ts

Lines changed: 192 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,196 @@
11
import { writeFile, stat } from "node:fs/promises";
22
import { z } from "zod";
33

4+
/**
5+
* @link https://chatgpt.com/c/6795dae3-8a10-800e-96af-fd0d01579f39
6+
* @link https://gemini.google.com/app/b47e9022a51a9846
7+
* */
8+
const responseOnlyHeaders = {
9+
"accept-patch": {
10+
proof:
11+
"Defined in RFC 5789, Section 3.1. Used by the server to indicate supported PATCH media types.",
12+
reason:
13+
"Servers use this header in responses to inform clients about supported PATCH formats.",
14+
},
15+
"accept-post": {
16+
proof: "Part of the WebDAV specification (RFC 7240, Section 4).",
17+
reason:
18+
"Sent in responses to indicate the types of POST requests that a server supports.",
19+
},
20+
"accept-ranges": {
21+
proof: "Defined in RFC 7233, Section 2.3.",
22+
reason:
23+
"The server uses this to tell the client it supports partial requests (e.g., byte ranges).",
24+
},
25+
"access-control-allow-credentials": {
26+
proof: "Defined in CORS Specification (Fetch Standard, Section 6.2).",
27+
reason: "Used in responses to indicate support for credentials in CORS.",
28+
},
29+
"access-control-allow-headers": {
30+
proof: "Defined in CORS Specification (Fetch Standard, Section 6.2).",
31+
reason: "Specifies allowed headers in preflight CORS responses.",
32+
},
33+
"access-control-allow-methods": {
34+
proof: "Defined in CORS Specification (Fetch Standard, Section 6.2).",
35+
reason: "Specifies allowed HTTP methods in preflight CORS responses.",
36+
},
37+
"access-control-allow-origin": {
38+
proof: "Defined in CORS Specification (Fetch Standard, Section 6.2).",
39+
reason: "Indicates allowed origins for CORS requests.",
40+
},
41+
"access-control-expose-headers": {
42+
proof: "Defined in CORS Specification (Fetch Standard, Section 6.2).",
43+
reason: "Lists headers exposed to the client in CORS responses.",
44+
},
45+
"access-control-max-age": {
46+
proof: "Defined in CORS Specification (Fetch Standard, Section 6.2).",
47+
reason:
48+
"Specifies how long preflight results can be cached in CORS responses.",
49+
},
50+
age: {
51+
proof: "Defined in RFC 7234, Section 5.1.",
52+
reason:
53+
"Indicates the age of a cached response, a concept relevant only to responses.",
54+
},
55+
allow: {
56+
proof: "Defined in RFC 7231, Section 7.4.1.",
57+
reason: "Used in responses to indicate supported methods for the resource.",
58+
},
59+
"alt-svc": {
60+
proof: "Defined in RFC 7838, Section 3.",
61+
reason: "The server advertises alternative services in responses.",
62+
},
63+
"cache-status": {
64+
proof: "Defined in RFC 9211.",
65+
reason: "Indicates the status of caching for the response.",
66+
},
67+
"cdn-cache-control": {
68+
proof:
69+
"An extension header often used by CDNs to communicate caching strategies; see examples in CDN-specific docs (e.g., Akamai or Cloudflare).",
70+
reason: "Relevant to response caching.",
71+
},
72+
"cdn-loop": {
73+
proof: "Defined in RFC 8586, Section 2.",
74+
reason:
75+
"Used to detect infinite loops within CDNs; appears only in responses.",
76+
},
77+
"clear-site-data": {
78+
description: "Instructs the user agent to clear browsing data.",
79+
proof: "RFC 7873: Server instructs client to clear data.",
80+
},
81+
"content-base": {
82+
proof:
83+
"Mentioned in early HTTP/1.1 specs (e.g., RFC 2068, Section 14.11). Deprecated, but applies only to server responses.",
84+
reason: "Specifies the base URL for relative URLs in a document.",
85+
},
86+
"content-security-policy": {
87+
proof: "Defined in the CSP Specification.",
88+
reason:
89+
"Used to define security policies for the content delivered in the response.",
90+
},
91+
"content-security-policy-report-only": {
92+
proof: "Defined in the CSP Specification.",
93+
reason: "A response-only variant of the CSP header for testing purposes.",
94+
},
95+
"content-style-type": {
96+
proof:
97+
"Deprecated but mentioned in early specifications (e.g., HTML 4.01).",
98+
reason:
99+
"Indicates the default stylesheet language; used in responses only.",
100+
},
101+
"content-version": {
102+
proof: "Part of early HTTP/1.1 drafts (e.g., RFC 2068, Section 14.14).",
103+
reason: "Specifies the version of the returned content; response-only.",
104+
},
105+
etag: {
106+
proof: "Defined in RFC 7232, Section 2.3.",
107+
reason:
108+
"Used to identify the version of a resource; relevant only to responses.",
109+
},
110+
expires: {
111+
proof: "Defined in RFC 7234, Section 5.3.",
112+
reason: "Indicates when the response content becomes stale.",
113+
},
114+
"last-modified": {
115+
proof: "Defined in RFC 7232, Section 2.2.",
116+
reason: "Communicates the last modification date of the resource.",
117+
},
118+
location: {
119+
proof: "Defined in RFC 7231, Section 7.1.2.",
120+
reason:
121+
"Used in redirection responses or to indicate the location of a created resource.",
122+
},
123+
"optional-www-authenticate": {
124+
proof: "Defined in RFC 8053, Section 3.",
125+
reason: "Allows a server to provide optional authentication mechanisms.",
126+
},
127+
"proxy-authenticate": {
128+
proof: "Defined in RFC 7235, Section 4.3.",
129+
reason: "Used in responses for proxy authentication.",
130+
},
131+
"proxy-authentication-info": {
132+
proof: "Defined in RFC 7615, Section 3.",
133+
reason:
134+
"Used by the server to provide information about proxy authentication.",
135+
},
136+
"proxy-status": {
137+
proof: "Defined in RFC 8586, Section 5.6.",
138+
reason: "Communicates proxy-specific status information in responses.",
139+
},
140+
refresh: {
141+
proof: "A non-standard but widely used header (MDN Docs).",
142+
reason: "Indicates redirection or automatic page refresh.",
143+
},
144+
"retry-after": {
145+
proof: "Defined in RFC 7231, Section 7.1.3.",
146+
reason:
147+
"Used in responses to indicate when the client should retry a request.",
148+
},
149+
"sec-websocket-accept": {
150+
proof: "Defined in RFC 6455, Section 11.3.3.",
151+
reason: "Used in WebSocket handshake responses to confirm acceptance.",
152+
},
153+
server: {
154+
proof: "Defined in RFC 7231, Section 7.4.2.",
155+
reason: "Identifies the server software handling the response.",
156+
},
157+
"server-timing": {
158+
proof: "Defined in W3C Server Timing Specification.",
159+
reason: "Provides server-side timing metrics in responses.",
160+
},
161+
"set-cookie": {
162+
proof: "Defined in RFC 6265, Section 4.1.",
163+
reason: "Used to set cookies in responses.",
164+
},
165+
"set-cookie2": {
166+
proof:
167+
"Deprecated but appeared in earlier specs like RFC 2965, Section 3.3.3.",
168+
reason: "A legacy header for setting cookies.",
169+
},
170+
"strict-transport-security": {
171+
proof: "Defined in RFC 6797, Section 6.1.",
172+
reason: "Enforces HTTPS policies in responses.",
173+
},
174+
"surrogate-control": {
175+
proof: "Defined in CDN-specific documentation (e.g., Akamai, Cloudflare).",
176+
reason: "Used to manage CDN-specific cache behavior in responses.",
177+
},
178+
"timing-allow-origin": {
179+
proof: "Defined in the Resource Timing Level 1 Spec.",
180+
reason:
181+
"Specifies which origins can access timing information in the response.",
182+
},
183+
vary: {
184+
description:
185+
"Tells caches that the response is variant and lists the headers that determine the variance.",
186+
proof: "RFC 9110, 15.8: Server specifies response variations.",
187+
},
188+
"www-authenticate": {
189+
proof: "Defined in RFC 7235, Section 4.1.",
190+
reason: "Used in responses for authentication challenges.",
191+
},
192+
};
193+
4194
const dest = "src/well-known-headers.json";
5195
const { mtime } = await stat(dest).then(
6196
(stats) => stats,
@@ -48,7 +238,8 @@ const headers = lines
48238
if (!success) console.debug("excluding", entry);
49239
return success;
50240
})
51-
.map(({ name }) => name.toLowerCase());
241+
.map(({ name }) => name.toLowerCase())
242+
.filter((name) => !(name in responseOnlyHeaders));
52243

53244
console.debug("CRC:", headers.length);
54245

0 commit comments

Comments
 (0)