@utilix-tech/sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +199 -0
- package/dist/api-8aZtWhSj.d.cts +308 -0
- package/dist/api-8aZtWhSj.d.ts +308 -0
- package/dist/chunk-2CJSLYWI.js +520 -0
- package/dist/chunk-3BAHSW4C.js +1385 -0
- package/dist/chunk-6YPV2AB5.js +1246 -0
- package/dist/chunk-BPVAB4P2.js +1126 -0
- package/dist/chunk-FL53T24A.js +257 -0
- package/dist/chunk-L6KCTHUW.js +1086 -0
- package/dist/chunk-MLKGABMK.js +7 -0
- package/dist/chunk-ROTPLW7T.js +265 -0
- package/dist/chunk-TSAGO3XP.js +1253 -0
- package/dist/chunk-UC656APA.js +1080 -0
- package/dist/chunk-W4UBLYFU.js +1219 -0
- package/dist/chunk-XST6X3HT.js +896 -0
- package/dist/chunk-XXYZLLHI.js +2227 -0
- package/dist/chunk-ZKL2VX2G.js +2215 -0
- package/dist/chunk-ZPQZEIXP.js +685 -0
- package/dist/code-QNrdLIR3.d.cts +327 -0
- package/dist/code-QNrdLIR3.d.ts +327 -0
- package/dist/color-tPwZCr9H.d.cts +229 -0
- package/dist/color-tPwZCr9H.d.ts +229 -0
- package/dist/css-Cf7AMGM-.d.cts +318 -0
- package/dist/css-Cf7AMGM-.d.ts +318 -0
- package/dist/data-rMjWNiOJ.d.cts +215 -0
- package/dist/data-rMjWNiOJ.d.ts +215 -0
- package/dist/encoding-7gmq-vkV.d.cts +108 -0
- package/dist/encoding-7gmq-vkV.d.ts +108 -0
- package/dist/generators-BGtRGpJZ.d.cts +118 -0
- package/dist/generators-BGtRGpJZ.d.ts +118 -0
- package/dist/hashing-CnetQFD_.d.cts +76 -0
- package/dist/hashing-CnetQFD_.d.ts +76 -0
- package/dist/index.cjs +15466 -0
- package/dist/index.d.cts +18 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +20 -0
- package/dist/json-BjSoIS1h.d.cts +198 -0
- package/dist/json-BjSoIS1h.d.ts +198 -0
- package/dist/misc-DcVBManm.d.cts +201 -0
- package/dist/misc-DcVBManm.d.ts +201 -0
- package/dist/network-CNtmrDeN.d.cts +170 -0
- package/dist/network-CNtmrDeN.d.ts +170 -0
- package/dist/text-DqAjPtQ0.d.cts +319 -0
- package/dist/text-DqAjPtQ0.d.ts +319 -0
- package/dist/time-DbT8fjaF.d.cts +145 -0
- package/dist/time-DbT8fjaF.d.ts +145 -0
- package/dist/tools/api.cjs +1216 -0
- package/dist/tools/api.d.cts +1 -0
- package/dist/tools/api.d.ts +1 -0
- package/dist/tools/api.js +2 -0
- package/dist/tools/code.cjs +2212 -0
- package/dist/tools/code.d.cts +1 -0
- package/dist/tools/code.d.ts +1 -0
- package/dist/tools/code.js +2 -0
- package/dist/tools/color.cjs +1122 -0
- package/dist/tools/color.d.cts +1 -0
- package/dist/tools/color.d.ts +1 -0
- package/dist/tools/color.js +2 -0
- package/dist/tools/css.cjs +1242 -0
- package/dist/tools/css.d.cts +1 -0
- package/dist/tools/css.d.ts +1 -0
- package/dist/tools/css.js +2 -0
- package/dist/tools/data.cjs +1097 -0
- package/dist/tools/data.d.cts +1 -0
- package/dist/tools/data.d.ts +1 -0
- package/dist/tools/data.js +2 -0
- package/dist/tools/encoding.cjs +261 -0
- package/dist/tools/encoding.d.cts +1 -0
- package/dist/tools/encoding.d.ts +1 -0
- package/dist/tools/encoding.js +2 -0
- package/dist/tools/generators.cjs +521 -0
- package/dist/tools/generators.d.cts +1 -0
- package/dist/tools/generators.d.ts +1 -0
- package/dist/tools/generators.js +2 -0
- package/dist/tools/hashing.cjs +259 -0
- package/dist/tools/hashing.d.cts +1 -0
- package/dist/tools/hashing.d.ts +1 -0
- package/dist/tools/hashing.js +2 -0
- package/dist/tools/json.cjs +1270 -0
- package/dist/tools/json.d.cts +1 -0
- package/dist/tools/json.d.ts +1 -0
- package/dist/tools/json.js +2 -0
- package/dist/tools/misc.cjs +1082 -0
- package/dist/tools/misc.d.cts +1 -0
- package/dist/tools/misc.d.ts +1 -0
- package/dist/tools/misc.js +2 -0
- package/dist/tools/network.cjs +1381 -0
- package/dist/tools/network.d.cts +1 -0
- package/dist/tools/network.d.ts +1 -0
- package/dist/tools/network.js +2 -0
- package/dist/tools/text.cjs +2224 -0
- package/dist/tools/text.d.cts +1 -0
- package/dist/tools/text.d.ts +1 -0
- package/dist/tools/text.js +2 -0
- package/dist/tools/time.cjs +681 -0
- package/dist/tools/time.d.cts +1 -0
- package/dist/tools/time.d.ts +1 -0
- package/dist/tools/time.js +2 -0
- package/dist/tools/units.cjs +892 -0
- package/dist/tools/units.d.cts +1 -0
- package/dist/tools/units.d.ts +1 -0
- package/dist/tools/units.js +2 -0
- package/dist/units-6lwDYBvX.d.cts +302 -0
- package/dist/units-6lwDYBvX.d.ts +302 -0
- package/package.json +148 -0
|
@@ -0,0 +1,1385 @@
|
|
|
1
|
+
import { __export } from './chunk-MLKGABMK.js';
|
|
2
|
+
|
|
3
|
+
// src/tools/network.ts
|
|
4
|
+
var network_exports = {};
|
|
5
|
+
__export(network_exports, {
|
|
6
|
+
DNS_RECORD_TYPES: () => DNS_RECORD_TYPES,
|
|
7
|
+
HTTP_HEADERS: () => HTTP_HEADERS,
|
|
8
|
+
STATUS_CODES: () => STATUS_CODES,
|
|
9
|
+
buildDnsQueryUrl: () => buildDnsQueryUrl,
|
|
10
|
+
buildGeoUrl: () => buildGeoUrl,
|
|
11
|
+
buildMapUrl: () => buildMapUrl,
|
|
12
|
+
countryCodeToFlag: () => countryCodeToFlag,
|
|
13
|
+
formatCoordinates: () => formatCoordinates,
|
|
14
|
+
formatTtl: () => formatTtl,
|
|
15
|
+
getByCategory: () => getByCategory,
|
|
16
|
+
getHeader: () => getHeader,
|
|
17
|
+
getHeadersByCategory: () => getHeadersByCategory,
|
|
18
|
+
getStatusByCategory: () => getStatusByCategory,
|
|
19
|
+
getStatusCode: () => getStatusCode,
|
|
20
|
+
isClientError: () => isClientError,
|
|
21
|
+
isServerError: () => isServerError,
|
|
22
|
+
isSuccess: () => isSuccess,
|
|
23
|
+
isValidIp: () => isValidIp,
|
|
24
|
+
isValidIpv4: () => isValidIpv4,
|
|
25
|
+
isValidIpv6: () => isValidIpv6,
|
|
26
|
+
parseDnsResponse: () => parseDnsResponse,
|
|
27
|
+
parseGeoResponse: () => parseGeoResponse,
|
|
28
|
+
searchHeaders: () => searchHeaders,
|
|
29
|
+
searchStatusCodes: () => searchStatusCodes,
|
|
30
|
+
statusCodeToText: () => statusCodeToText,
|
|
31
|
+
typeNumberToLabel: () => typeNumberToLabel,
|
|
32
|
+
validateDomain: () => validateDomain,
|
|
33
|
+
validateHeaderName: () => validateHeaderName,
|
|
34
|
+
validateHeaderValue: () => validateHeaderValue
|
|
35
|
+
});
|
|
36
|
+
var DNS_RECORD_TYPES = ["A", "AAAA", "CNAME", "MX", "TXT", "NS", "SOA", "PTR", "SRV", "CAA"];
|
|
37
|
+
function buildDnsQueryUrl(domain, type) {
|
|
38
|
+
const encoded = encodeURIComponent(domain);
|
|
39
|
+
return `https://cloudflare-dns.com/dns-query?name=${encoded}&type=${type}`;
|
|
40
|
+
}
|
|
41
|
+
function typeNumberToLabel(typeNum) {
|
|
42
|
+
const map = {
|
|
43
|
+
1: "A",
|
|
44
|
+
2: "NS",
|
|
45
|
+
5: "CNAME",
|
|
46
|
+
6: "SOA",
|
|
47
|
+
12: "PTR",
|
|
48
|
+
15: "MX",
|
|
49
|
+
16: "TXT",
|
|
50
|
+
28: "AAAA",
|
|
51
|
+
33: "SRV",
|
|
52
|
+
257: "CAA"
|
|
53
|
+
};
|
|
54
|
+
return map[typeNum] ?? `TYPE${typeNum}`;
|
|
55
|
+
}
|
|
56
|
+
function parseDnsResponse(response, domain, type) {
|
|
57
|
+
const statusText = statusCodeToText(response.Status);
|
|
58
|
+
let status;
|
|
59
|
+
if (response.Status === 0) {
|
|
60
|
+
status = "ok";
|
|
61
|
+
} else if (response.Status === 3) {
|
|
62
|
+
status = "nxdomain";
|
|
63
|
+
} else {
|
|
64
|
+
status = "error";
|
|
65
|
+
}
|
|
66
|
+
const records = (response.Answer ?? []).map((r) => ({
|
|
67
|
+
name: r.name,
|
|
68
|
+
ttl: r.TTL,
|
|
69
|
+
data: r.data,
|
|
70
|
+
typeLabel: typeNumberToLabel(r.type)
|
|
71
|
+
}));
|
|
72
|
+
return {
|
|
73
|
+
domain,
|
|
74
|
+
type,
|
|
75
|
+
records,
|
|
76
|
+
status,
|
|
77
|
+
statusText,
|
|
78
|
+
raw: response
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function validateDomain(domain) {
|
|
82
|
+
if (!domain || domain.length === 0 || domain.length > 253) return false;
|
|
83
|
+
const ipv4 = /^(\d{1,3}\.){3}\d{1,3}$/;
|
|
84
|
+
if (ipv4.test(domain)) {
|
|
85
|
+
return domain.split(".").every((part) => parseInt(part, 10) <= 255);
|
|
86
|
+
}
|
|
87
|
+
if (domain.includes(":")) {
|
|
88
|
+
return /^[0-9a-fA-F:]+$/.test(domain);
|
|
89
|
+
}
|
|
90
|
+
const labels = domain.split(".");
|
|
91
|
+
return labels.every((label) => {
|
|
92
|
+
if (label.length === 0 || label.length > 63) return false;
|
|
93
|
+
if (label.startsWith("-") || label.endsWith("-")) return false;
|
|
94
|
+
return /^[a-zA-Z0-9-]+$/.test(label);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
function formatTtl(seconds) {
|
|
98
|
+
if (seconds <= 0) return "0s";
|
|
99
|
+
const days = Math.floor(seconds / 86400);
|
|
100
|
+
const hours = Math.floor(seconds % 86400 / 3600);
|
|
101
|
+
const minutes = Math.floor(seconds % 3600 / 60);
|
|
102
|
+
const secs = seconds % 60;
|
|
103
|
+
const parts = [];
|
|
104
|
+
if (days > 0) parts.push(`${days}d`);
|
|
105
|
+
if (hours > 0) parts.push(`${hours}h`);
|
|
106
|
+
if (minutes > 0) parts.push(`${minutes}m`);
|
|
107
|
+
if (secs > 0) parts.push(`${secs}s`);
|
|
108
|
+
return parts.join(" ");
|
|
109
|
+
}
|
|
110
|
+
function statusCodeToText(status) {
|
|
111
|
+
const map = {
|
|
112
|
+
0: "NOERROR",
|
|
113
|
+
1: "FORMERR",
|
|
114
|
+
2: "SERVFAIL",
|
|
115
|
+
3: "NXDOMAIN",
|
|
116
|
+
4: "NOTIMP",
|
|
117
|
+
5: "REFUSED",
|
|
118
|
+
6: "YXDOMAIN",
|
|
119
|
+
7: "YXRRSET",
|
|
120
|
+
8: "NXRRSET",
|
|
121
|
+
9: "NOTAUTH",
|
|
122
|
+
10: "NOTZONE"
|
|
123
|
+
};
|
|
124
|
+
return map[status] ?? `RCODE${status}`;
|
|
125
|
+
}
|
|
126
|
+
var GEO_FIELDS = "status,message,country,countryCode,region,regionName,city,zip,lat,lon,timezone,isp,org,as,query";
|
|
127
|
+
function buildGeoUrl(ip) {
|
|
128
|
+
if (!ip || ip.trim() === "") {
|
|
129
|
+
return "https://ip-api.com/json/";
|
|
130
|
+
}
|
|
131
|
+
return `https://ip-api.com/json/${encodeURIComponent(ip.trim())}?fields=${GEO_FIELDS}`;
|
|
132
|
+
}
|
|
133
|
+
function parseGeoResponse(data) {
|
|
134
|
+
if (data.status === "fail") {
|
|
135
|
+
return { error: data.message ?? "Lookup failed" };
|
|
136
|
+
}
|
|
137
|
+
const location = [data.city, data.regionName, data.country].filter(Boolean).join(", ");
|
|
138
|
+
return {
|
|
139
|
+
ip: data.query ?? data.ip ?? "",
|
|
140
|
+
location,
|
|
141
|
+
coordinates: formatCoordinates(data.lat, data.lon),
|
|
142
|
+
timezone: data.timezone ?? "",
|
|
143
|
+
isp: data.isp ?? "",
|
|
144
|
+
org: data.org ?? "",
|
|
145
|
+
asn: data.as ?? "",
|
|
146
|
+
mapUrl: buildMapUrl(data.lat, data.lon),
|
|
147
|
+
countryFlag: countryCodeToFlag(data.countryCode ?? "")
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
function isValidIpv4(ip) {
|
|
151
|
+
const parts = ip.split(".");
|
|
152
|
+
if (parts.length !== 4) return false;
|
|
153
|
+
return parts.every((part) => {
|
|
154
|
+
if (!/^\d+$/.test(part)) return false;
|
|
155
|
+
const num = parseInt(part, 10);
|
|
156
|
+
return num >= 0 && num <= 255 && String(num) === part;
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
function isValidIpv6(ip) {
|
|
160
|
+
const doubleColon = ip.split("::");
|
|
161
|
+
if (doubleColon.length > 2) return false;
|
|
162
|
+
const groups = ip.replace("::", ":0000:").split(":").filter((g) => g !== "");
|
|
163
|
+
if (groups.length < 2 || groups.length > 8) {
|
|
164
|
+
if (ip === "::") return true;
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
return groups.every((g) => /^[0-9a-fA-F]{1,4}$/.test(g));
|
|
168
|
+
}
|
|
169
|
+
function isValidIp(ip) {
|
|
170
|
+
return isValidIpv4(ip) || isValidIpv6(ip);
|
|
171
|
+
}
|
|
172
|
+
function countryCodeToFlag(code) {
|
|
173
|
+
if (!code || code.length !== 2) return "";
|
|
174
|
+
const upper = code.toUpperCase();
|
|
175
|
+
return Array.from(upper).map((char) => String.fromCodePoint(127462 + (char.charCodeAt(0) - 65))).join("");
|
|
176
|
+
}
|
|
177
|
+
function formatCoordinates(lat, lon) {
|
|
178
|
+
const latDir = lat >= 0 ? "N" : "S";
|
|
179
|
+
const lonDir = lon >= 0 ? "E" : "W";
|
|
180
|
+
const absLat = Math.abs(lat).toFixed(4);
|
|
181
|
+
const absLon = Math.abs(lon).toFixed(4);
|
|
182
|
+
return `${absLat}\xB0 ${latDir}, ${absLon}\xB0 ${lonDir}`;
|
|
183
|
+
}
|
|
184
|
+
function buildMapUrl(lat, lon, zoom = 12) {
|
|
185
|
+
return `https://www.openstreetmap.org/?mlat=${lat}&mlon=${lon}&zoom=${zoom}`;
|
|
186
|
+
}
|
|
187
|
+
var STATUS_CODES = [
|
|
188
|
+
{
|
|
189
|
+
code: 100,
|
|
190
|
+
name: "Continue",
|
|
191
|
+
description: "The server has received the request headers and the client should proceed to send the request body.",
|
|
192
|
+
category: "1xx",
|
|
193
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/100"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
code: 101,
|
|
197
|
+
name: "Switching Protocols",
|
|
198
|
+
description: "The requester has asked the server to switch protocols and the server has agreed to do so.",
|
|
199
|
+
category: "1xx",
|
|
200
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/101"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
code: 102,
|
|
204
|
+
name: "Processing",
|
|
205
|
+
description: "The server has received and is processing the request, but no response is available yet.",
|
|
206
|
+
category: "1xx",
|
|
207
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/102"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
code: 103,
|
|
211
|
+
name: "Early Hints",
|
|
212
|
+
description: "Used to return some response headers before final HTTP message.",
|
|
213
|
+
category: "1xx",
|
|
214
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/103"
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
code: 200,
|
|
218
|
+
name: "OK",
|
|
219
|
+
description: "The request has succeeded.",
|
|
220
|
+
category: "2xx",
|
|
221
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200"
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
code: 201,
|
|
225
|
+
name: "Created",
|
|
226
|
+
description: "The request has succeeded and a new resource has been created as a result.",
|
|
227
|
+
category: "2xx",
|
|
228
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/201"
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
code: 202,
|
|
232
|
+
name: "Accepted",
|
|
233
|
+
description: "The request has been received but not yet acted upon.",
|
|
234
|
+
category: "2xx",
|
|
235
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/202"
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
code: 203,
|
|
239
|
+
name: "Non-Authoritative Information",
|
|
240
|
+
description: "The returned metadata is not exactly the same as is available from the origin server.",
|
|
241
|
+
category: "2xx",
|
|
242
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/203"
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
code: 204,
|
|
246
|
+
name: "No Content",
|
|
247
|
+
description: "There is no content to send for this request, but the headers may be useful.",
|
|
248
|
+
category: "2xx",
|
|
249
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204"
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
code: 205,
|
|
253
|
+
name: "Reset Content",
|
|
254
|
+
description: "Tells the user agent to reset the document which sent this request.",
|
|
255
|
+
category: "2xx",
|
|
256
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/205"
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
code: 206,
|
|
260
|
+
name: "Partial Content",
|
|
261
|
+
description: "This response code is used when the Range header is sent from the client to request only part of a resource.",
|
|
262
|
+
category: "2xx",
|
|
263
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/206"
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
code: 207,
|
|
267
|
+
name: "Multi-Status",
|
|
268
|
+
description: "Conveys information about multiple resources, for situations where multiple status codes might be appropriate.",
|
|
269
|
+
category: "2xx",
|
|
270
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/207"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
code: 208,
|
|
274
|
+
name: "Already Reported",
|
|
275
|
+
description: "Used inside a DAV binding to avoid repeatedly enumerating the internal members of multiple bindings to the same collection.",
|
|
276
|
+
category: "2xx",
|
|
277
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/208"
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
code: 226,
|
|
281
|
+
name: "IM Used",
|
|
282
|
+
description: "The server has fulfilled a GET request for the resource, and the response is a representation of the result of one or more instance-manipulations applied to the current instance.",
|
|
283
|
+
category: "2xx",
|
|
284
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/226"
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
code: 300,
|
|
288
|
+
name: "Multiple Choices",
|
|
289
|
+
description: "The request has more than one possible response. The user agent or user should choose one of them.",
|
|
290
|
+
category: "3xx",
|
|
291
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/300"
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
code: 301,
|
|
295
|
+
name: "Moved Permanently",
|
|
296
|
+
description: "The URL of the requested resource has been changed permanently. The new URL is given in the response.",
|
|
297
|
+
category: "3xx",
|
|
298
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/301"
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
code: 302,
|
|
302
|
+
name: "Found",
|
|
303
|
+
description: "This response code means that the URI of requested resource has been changed temporarily.",
|
|
304
|
+
category: "3xx",
|
|
305
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302"
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
code: 303,
|
|
309
|
+
name: "See Other",
|
|
310
|
+
description: "The server sent this response to direct the client to get the requested resource at another URI with a GET request.",
|
|
311
|
+
category: "3xx",
|
|
312
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/303"
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
code: 304,
|
|
316
|
+
name: "Not Modified",
|
|
317
|
+
description: "This is used for caching purposes. It tells the client that the response has not been modified.",
|
|
318
|
+
category: "3xx",
|
|
319
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/304"
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
code: 307,
|
|
323
|
+
name: "Temporary Redirect",
|
|
324
|
+
description: "The server sends this response to direct the client to get the requested resource at another URI with same method that was used in the prior request.",
|
|
325
|
+
category: "3xx",
|
|
326
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/307"
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
code: 308,
|
|
330
|
+
name: "Permanent Redirect",
|
|
331
|
+
description: "This means that the resource is now permanently located at another URI, specified by the Location response header.",
|
|
332
|
+
category: "3xx",
|
|
333
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/308"
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
code: 400,
|
|
337
|
+
name: "Bad Request",
|
|
338
|
+
description: "The server cannot or will not process the request due to something that is perceived to be a client error.",
|
|
339
|
+
category: "4xx",
|
|
340
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400"
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
code: 401,
|
|
344
|
+
name: "Unauthorized",
|
|
345
|
+
description: 'Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated".',
|
|
346
|
+
category: "4xx",
|
|
347
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401"
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
code: 402,
|
|
351
|
+
name: "Payment Required",
|
|
352
|
+
description: "This response code is reserved for future use. The initial aim was for digital payment systems.",
|
|
353
|
+
category: "4xx",
|
|
354
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/402"
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
code: 403,
|
|
358
|
+
name: "Forbidden",
|
|
359
|
+
description: "The client does not have access rights to the content; that is, it is unauthorized, so the server is refusing to give the requested resource.",
|
|
360
|
+
category: "4xx",
|
|
361
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403"
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
code: 404,
|
|
365
|
+
name: "Not Found",
|
|
366
|
+
description: "The server cannot find the requested resource. In the browser, this means the URL is not recognized.",
|
|
367
|
+
category: "4xx",
|
|
368
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404"
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
code: 405,
|
|
372
|
+
name: "Method Not Allowed",
|
|
373
|
+
description: "The request method is known by the server but is not supported by the target resource.",
|
|
374
|
+
category: "4xx",
|
|
375
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405"
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
code: 406,
|
|
379
|
+
name: "Not Acceptable",
|
|
380
|
+
description: "This response is sent when the web server, after performing server-driven content negotiation, does not find any content that conforms to the criteria given by the user agent.",
|
|
381
|
+
category: "4xx",
|
|
382
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/406"
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
code: 407,
|
|
386
|
+
name: "Proxy Authentication Required",
|
|
387
|
+
description: "This is similar to 401 Unauthorized but authentication is needed to be done by a proxy.",
|
|
388
|
+
category: "4xx",
|
|
389
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/407"
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
code: 408,
|
|
393
|
+
name: "Request Timeout",
|
|
394
|
+
description: "This response is sent on an idle connection by some servers, even without any previous request by the client.",
|
|
395
|
+
category: "4xx",
|
|
396
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408"
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
code: 409,
|
|
400
|
+
name: "Conflict",
|
|
401
|
+
description: "This response is sent when a request conflicts with the current state of the server.",
|
|
402
|
+
category: "4xx",
|
|
403
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409"
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
code: 410,
|
|
407
|
+
name: "Gone",
|
|
408
|
+
description: "This response is sent when the requested content has been permanently deleted from server, with no forwarding address.",
|
|
409
|
+
category: "4xx",
|
|
410
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/410"
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
code: 411,
|
|
414
|
+
name: "Length Required",
|
|
415
|
+
description: "Server rejected the request because the Content-Length header field is not defined and the server requires it.",
|
|
416
|
+
category: "4xx",
|
|
417
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/411"
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
code: 412,
|
|
421
|
+
name: "Precondition Failed",
|
|
422
|
+
description: "The client has indicated preconditions in its headers which the server does not meet.",
|
|
423
|
+
category: "4xx",
|
|
424
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412"
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
code: 413,
|
|
428
|
+
name: "Content Too Large",
|
|
429
|
+
description: "Request entity is larger than limits defined by server.",
|
|
430
|
+
category: "4xx",
|
|
431
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/413"
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
code: 414,
|
|
435
|
+
name: "URI Too Long",
|
|
436
|
+
description: "The URI requested by the client is longer than the server is willing to interpret.",
|
|
437
|
+
category: "4xx",
|
|
438
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/414"
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
code: 415,
|
|
442
|
+
name: "Unsupported Media Type",
|
|
443
|
+
description: "The media format of the requested data is not supported by the server.",
|
|
444
|
+
category: "4xx",
|
|
445
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/415"
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
code: 416,
|
|
449
|
+
name: "Range Not Satisfiable",
|
|
450
|
+
description: "The range specified by the Range header field in the request cannot be fulfilled.",
|
|
451
|
+
category: "4xx",
|
|
452
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/416"
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
code: 417,
|
|
456
|
+
name: "Expectation Failed",
|
|
457
|
+
description: "This response code means the expectation indicated by the Expect request header field cannot be met by the server.",
|
|
458
|
+
category: "4xx",
|
|
459
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/417"
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
code: 418,
|
|
463
|
+
name: "I'm a Teapot",
|
|
464
|
+
description: "The server refuses the attempt to brew coffee with a teapot.",
|
|
465
|
+
category: "4xx",
|
|
466
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/418"
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
code: 421,
|
|
470
|
+
name: "Misdirected Request",
|
|
471
|
+
description: "The request was directed at a server that is not able to produce a response.",
|
|
472
|
+
category: "4xx",
|
|
473
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/421"
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
code: 422,
|
|
477
|
+
name: "Unprocessable Content",
|
|
478
|
+
description: "The request was well-formed but was unable to be followed due to semantic errors.",
|
|
479
|
+
category: "4xx",
|
|
480
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422"
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
code: 423,
|
|
484
|
+
name: "Locked",
|
|
485
|
+
description: "The resource that is being accessed is locked.",
|
|
486
|
+
category: "4xx",
|
|
487
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/423"
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
code: 424,
|
|
491
|
+
name: "Failed Dependency",
|
|
492
|
+
description: "The request failed due to failure of a previous request.",
|
|
493
|
+
category: "4xx",
|
|
494
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/424"
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
code: 425,
|
|
498
|
+
name: "Too Early",
|
|
499
|
+
description: "Indicates that the server is unwilling to risk processing a request that might be replayed.",
|
|
500
|
+
category: "4xx",
|
|
501
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/425"
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
code: 426,
|
|
505
|
+
name: "Upgrade Required",
|
|
506
|
+
description: "The server refuses to perform the request using the current protocol but might be willing to do so after the client upgrades to a different protocol.",
|
|
507
|
+
category: "4xx",
|
|
508
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/426"
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
code: 428,
|
|
512
|
+
name: "Precondition Required",
|
|
513
|
+
description: "The origin server requires the request to be conditional.",
|
|
514
|
+
category: "4xx",
|
|
515
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/428"
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
code: 429,
|
|
519
|
+
name: "Too Many Requests",
|
|
520
|
+
description: 'The user has sent too many requests in a given amount of time ("rate limiting").',
|
|
521
|
+
category: "4xx",
|
|
522
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429"
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
code: 431,
|
|
526
|
+
name: "Request Header Fields Too Large",
|
|
527
|
+
description: "The server is unwilling to process the request because its header fields are too large.",
|
|
528
|
+
category: "4xx",
|
|
529
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/431"
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
code: 451,
|
|
533
|
+
name: "Unavailable For Legal Reasons",
|
|
534
|
+
description: "The user agent requested a resource that cannot legally be provided, such as a web page censored by a government.",
|
|
535
|
+
category: "4xx",
|
|
536
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/451"
|
|
537
|
+
},
|
|
538
|
+
{
|
|
539
|
+
code: 500,
|
|
540
|
+
name: "Internal Server Error",
|
|
541
|
+
description: "The server has encountered a situation it does not know how to handle.",
|
|
542
|
+
category: "5xx",
|
|
543
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500"
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
code: 501,
|
|
547
|
+
name: "Not Implemented",
|
|
548
|
+
description: "The request method is not supported by the server and cannot be handled.",
|
|
549
|
+
category: "5xx",
|
|
550
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/501"
|
|
551
|
+
},
|
|
552
|
+
{
|
|
553
|
+
code: 502,
|
|
554
|
+
name: "Bad Gateway",
|
|
555
|
+
description: "This error response means that the server, while working as a gateway to get a response needed to handle the request, got an invalid response.",
|
|
556
|
+
category: "5xx",
|
|
557
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502"
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
code: 503,
|
|
561
|
+
name: "Service Unavailable",
|
|
562
|
+
description: "The server is not ready to handle the request. Common causes are a server that is down for maintenance or that is overloaded.",
|
|
563
|
+
category: "5xx",
|
|
564
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503"
|
|
565
|
+
},
|
|
566
|
+
{
|
|
567
|
+
code: 504,
|
|
568
|
+
name: "Gateway Timeout",
|
|
569
|
+
description: "This error response is given when the server is acting as a gateway and cannot get a response in time.",
|
|
570
|
+
category: "5xx",
|
|
571
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504"
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
code: 505,
|
|
575
|
+
name: "HTTP Version Not Supported",
|
|
576
|
+
description: "The HTTP version used in the request is not supported by the server.",
|
|
577
|
+
category: "5xx",
|
|
578
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/505"
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
code: 506,
|
|
582
|
+
name: "Variant Also Negotiates",
|
|
583
|
+
description: "The server has an internal configuration error: the chosen variant resource is configured to engage in transparent content negotiation itself.",
|
|
584
|
+
category: "5xx",
|
|
585
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/506"
|
|
586
|
+
},
|
|
587
|
+
{
|
|
588
|
+
code: 507,
|
|
589
|
+
name: "Insufficient Storage",
|
|
590
|
+
description: "The method could not be performed on the resource because the server is unable to store the representation needed to successfully complete the request.",
|
|
591
|
+
category: "5xx",
|
|
592
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/507"
|
|
593
|
+
},
|
|
594
|
+
{
|
|
595
|
+
code: 508,
|
|
596
|
+
name: "Loop Detected",
|
|
597
|
+
description: "The server detected an infinite loop while processing the request.",
|
|
598
|
+
category: "5xx",
|
|
599
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/508"
|
|
600
|
+
},
|
|
601
|
+
{
|
|
602
|
+
code: 510,
|
|
603
|
+
name: "Not Extended",
|
|
604
|
+
description: "Further extensions to the request are required for the server to fulfill it.",
|
|
605
|
+
category: "5xx",
|
|
606
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/510"
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
code: 511,
|
|
610
|
+
name: "Network Authentication Required",
|
|
611
|
+
description: "Indicates that the client needs to authenticate to gain network access.",
|
|
612
|
+
category: "5xx",
|
|
613
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/511"
|
|
614
|
+
}
|
|
615
|
+
];
|
|
616
|
+
function getStatusCode(code) {
|
|
617
|
+
return STATUS_CODES.find((s) => s.code === code);
|
|
618
|
+
}
|
|
619
|
+
function getStatusByCategory(category) {
|
|
620
|
+
return STATUS_CODES.filter((s) => s.category === category);
|
|
621
|
+
}
|
|
622
|
+
function searchStatusCodes(query) {
|
|
623
|
+
const q = query.toLowerCase();
|
|
624
|
+
return STATUS_CODES.filter(
|
|
625
|
+
(s) => s.code.toString().includes(q) || s.name.toLowerCase().includes(q) || s.description.toLowerCase().includes(q)
|
|
626
|
+
);
|
|
627
|
+
}
|
|
628
|
+
function isSuccess(code) {
|
|
629
|
+
return code >= 200 && code < 300;
|
|
630
|
+
}
|
|
631
|
+
function isClientError(code) {
|
|
632
|
+
return code >= 400 && code < 500;
|
|
633
|
+
}
|
|
634
|
+
function isServerError(code) {
|
|
635
|
+
return code >= 500 && code < 600;
|
|
636
|
+
}
|
|
637
|
+
var HTTP_HEADERS = [
|
|
638
|
+
{
|
|
639
|
+
name: "Accept",
|
|
640
|
+
category: "request",
|
|
641
|
+
description: "Informs the server about the types of data that can be sent back.",
|
|
642
|
+
example: "Accept: text/html, application/xhtml+xml, application/xml;q=0.9, */*;q=0.8",
|
|
643
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept",
|
|
644
|
+
standard: true
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
name: "Accept-Charset",
|
|
648
|
+
category: "request",
|
|
649
|
+
description: "Indicates which character encodings the client understands.",
|
|
650
|
+
example: "Accept-Charset: utf-8, iso-8859-1;q=0.5",
|
|
651
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Charset",
|
|
652
|
+
standard: true
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
name: "Accept-Encoding",
|
|
656
|
+
category: "request",
|
|
657
|
+
description: "Indicates the content-encoding (usually a compression algorithm) that the client can understand.",
|
|
658
|
+
example: "Accept-Encoding: gzip, deflate, br",
|
|
659
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding",
|
|
660
|
+
standard: true
|
|
661
|
+
},
|
|
662
|
+
{
|
|
663
|
+
name: "Accept-Language",
|
|
664
|
+
category: "request",
|
|
665
|
+
description: "Indicates the natural language and locale that the client prefers.",
|
|
666
|
+
example: "Accept-Language: en-US, en;q=0.9, fr;q=0.8",
|
|
667
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language",
|
|
668
|
+
standard: true
|
|
669
|
+
},
|
|
670
|
+
{
|
|
671
|
+
name: "Authorization",
|
|
672
|
+
category: "request",
|
|
673
|
+
description: "Contains the credentials to authenticate a user-agent with a server.",
|
|
674
|
+
example: "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
|
|
675
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization",
|
|
676
|
+
standard: true
|
|
677
|
+
},
|
|
678
|
+
{
|
|
679
|
+
name: "Connection",
|
|
680
|
+
category: "request",
|
|
681
|
+
description: "Controls whether the network connection stays open after the current transaction finishes.",
|
|
682
|
+
example: "Connection: keep-alive",
|
|
683
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Connection",
|
|
684
|
+
standard: true
|
|
685
|
+
},
|
|
686
|
+
{
|
|
687
|
+
name: "Cookie",
|
|
688
|
+
category: "request",
|
|
689
|
+
description: "Contains stored HTTP cookies previously sent by the server with the Set-Cookie header.",
|
|
690
|
+
example: "Cookie: session_id=abc123; theme=dark",
|
|
691
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cookie",
|
|
692
|
+
standard: true
|
|
693
|
+
},
|
|
694
|
+
{
|
|
695
|
+
name: "DNT",
|
|
696
|
+
category: "request",
|
|
697
|
+
description: "Expresses the user preference to not be tracked.",
|
|
698
|
+
example: "DNT: 1",
|
|
699
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/DNT",
|
|
700
|
+
standard: false
|
|
701
|
+
},
|
|
702
|
+
{
|
|
703
|
+
name: "Expect",
|
|
704
|
+
category: "request",
|
|
705
|
+
description: "Indicates expectations that need to be fulfilled by the server in order to properly handle the request.",
|
|
706
|
+
example: "Expect: 100-continue",
|
|
707
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expect",
|
|
708
|
+
standard: true
|
|
709
|
+
},
|
|
710
|
+
{
|
|
711
|
+
name: "From",
|
|
712
|
+
category: "request",
|
|
713
|
+
description: "Contains an Internet email address for a human user who controls the requesting user agent.",
|
|
714
|
+
example: "From: webmaster@example.com",
|
|
715
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/From",
|
|
716
|
+
standard: true
|
|
717
|
+
},
|
|
718
|
+
{
|
|
719
|
+
name: "Host",
|
|
720
|
+
category: "request",
|
|
721
|
+
description: "Specifies the host and port number of the server to which the request is being sent.",
|
|
722
|
+
example: "Host: www.example.com:443",
|
|
723
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Host",
|
|
724
|
+
standard: true
|
|
725
|
+
},
|
|
726
|
+
{
|
|
727
|
+
name: "If-Match",
|
|
728
|
+
category: "caching",
|
|
729
|
+
description: "Makes the request conditional, only performing the method if the stored resource matches one of the given ETags.",
|
|
730
|
+
example: 'If-Match: "737060cd8c284d8af7ad3082f209582d"',
|
|
731
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match",
|
|
732
|
+
standard: true
|
|
733
|
+
},
|
|
734
|
+
{
|
|
735
|
+
name: "If-Modified-Since",
|
|
736
|
+
category: "caching",
|
|
737
|
+
description: "Makes the request conditional, expecting the server to return the resource only if it has been modified after the given date.",
|
|
738
|
+
example: "If-Modified-Since: Wed, 21 Oct 2015 07:28:00 GMT",
|
|
739
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Modified-Since",
|
|
740
|
+
standard: true
|
|
741
|
+
},
|
|
742
|
+
{
|
|
743
|
+
name: "If-None-Match",
|
|
744
|
+
category: "caching",
|
|
745
|
+
description: "Makes the request conditional, only returning the resource if none of the provided ETags match the current stored resource.",
|
|
746
|
+
example: 'If-None-Match: "737060cd8c284d8af7ad3082f209582d"',
|
|
747
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-None-Match",
|
|
748
|
+
standard: true
|
|
749
|
+
},
|
|
750
|
+
{
|
|
751
|
+
name: "If-Range",
|
|
752
|
+
category: "caching",
|
|
753
|
+
description: "Makes a range request conditional: if the condition is fulfilled, the range request is issued; otherwise the full resource is returned.",
|
|
754
|
+
example: 'If-Range: "737060cd8c284d8af7ad3082f209582d"',
|
|
755
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Range",
|
|
756
|
+
standard: true
|
|
757
|
+
},
|
|
758
|
+
{
|
|
759
|
+
name: "If-Unmodified-Since",
|
|
760
|
+
category: "request",
|
|
761
|
+
description: "Makes the request conditional, only performing the operation if the entity has not been modified since the given date.",
|
|
762
|
+
example: "If-Unmodified-Since: Wed, 21 Oct 2015 07:28:00 GMT",
|
|
763
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Unmodified-Since",
|
|
764
|
+
standard: true
|
|
765
|
+
},
|
|
766
|
+
{
|
|
767
|
+
name: "Max-Forwards",
|
|
768
|
+
category: "request",
|
|
769
|
+
description: "Indicates the maximum number of times the request can be forwarded through proxies or gateways.",
|
|
770
|
+
example: "Max-Forwards: 10",
|
|
771
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Max-Forwards",
|
|
772
|
+
standard: true
|
|
773
|
+
},
|
|
774
|
+
{
|
|
775
|
+
name: "Origin",
|
|
776
|
+
category: "request",
|
|
777
|
+
description: "Indicates where a fetch originates from.",
|
|
778
|
+
example: "Origin: https://www.example.com",
|
|
779
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin",
|
|
780
|
+
standard: true
|
|
781
|
+
},
|
|
782
|
+
{
|
|
783
|
+
name: "Proxy-Authorization",
|
|
784
|
+
category: "request",
|
|
785
|
+
description: "Contains the credentials to authenticate a user agent with a proxy server.",
|
|
786
|
+
example: "Proxy-Authorization: Basic dXNlcjpwYXNzd29yZA==",
|
|
787
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Proxy-Authorization",
|
|
788
|
+
standard: true
|
|
789
|
+
},
|
|
790
|
+
{
|
|
791
|
+
name: "Range",
|
|
792
|
+
category: "request",
|
|
793
|
+
description: "Indicates the part of a document that the server should return.",
|
|
794
|
+
example: "Range: bytes=200-1000",
|
|
795
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range",
|
|
796
|
+
standard: true
|
|
797
|
+
},
|
|
798
|
+
{
|
|
799
|
+
name: "Referer",
|
|
800
|
+
category: "request",
|
|
801
|
+
description: "Contains the address of the previous web page from which a link to the currently requested page was followed.",
|
|
802
|
+
example: "Referer: https://www.example.com/page.html",
|
|
803
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer",
|
|
804
|
+
standard: true
|
|
805
|
+
},
|
|
806
|
+
{
|
|
807
|
+
name: "TE",
|
|
808
|
+
category: "request",
|
|
809
|
+
description: "Specifies the transfer encodings the user agent is willing to accept.",
|
|
810
|
+
example: "TE: trailers, deflate;q=0.5",
|
|
811
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/TE",
|
|
812
|
+
standard: true
|
|
813
|
+
},
|
|
814
|
+
{
|
|
815
|
+
name: "Upgrade",
|
|
816
|
+
category: "request",
|
|
817
|
+
description: "Asks the server to upgrade to another protocol.",
|
|
818
|
+
example: "Upgrade: websocket",
|
|
819
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Upgrade",
|
|
820
|
+
standard: true
|
|
821
|
+
},
|
|
822
|
+
{
|
|
823
|
+
name: "User-Agent",
|
|
824
|
+
category: "request",
|
|
825
|
+
description: "Contains a characteristic string that allows the network protocol peers to identify the application type, operating system, and software vendor.",
|
|
826
|
+
example: "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
|
|
827
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent",
|
|
828
|
+
standard: true
|
|
829
|
+
},
|
|
830
|
+
{
|
|
831
|
+
name: "Accept-Ranges",
|
|
832
|
+
category: "response",
|
|
833
|
+
description: "Indicates if the server supports range requests, and if so in which unit the range can be expressed.",
|
|
834
|
+
example: "Accept-Ranges: bytes",
|
|
835
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Ranges",
|
|
836
|
+
standard: true
|
|
837
|
+
},
|
|
838
|
+
{
|
|
839
|
+
name: "Age",
|
|
840
|
+
category: "response",
|
|
841
|
+
description: "The time in seconds the object was in a proxy cache.",
|
|
842
|
+
example: "Age: 24",
|
|
843
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Age",
|
|
844
|
+
standard: true
|
|
845
|
+
},
|
|
846
|
+
{
|
|
847
|
+
name: "Allow",
|
|
848
|
+
category: "response",
|
|
849
|
+
description: "Lists the HTTP request methods supported by a resource.",
|
|
850
|
+
example: "Allow: GET, POST, HEAD",
|
|
851
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Allow",
|
|
852
|
+
standard: true
|
|
853
|
+
},
|
|
854
|
+
{
|
|
855
|
+
name: "Content-Disposition",
|
|
856
|
+
category: "response",
|
|
857
|
+
description: "Indicates if the content is expected to be displayed inline or as an attachment.",
|
|
858
|
+
example: 'Content-Disposition: attachment; filename="file.pdf"',
|
|
859
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition",
|
|
860
|
+
standard: true
|
|
861
|
+
},
|
|
862
|
+
{
|
|
863
|
+
name: "Content-Encoding",
|
|
864
|
+
category: "response",
|
|
865
|
+
description: "Specifies the encoding transformations applied to the resource body.",
|
|
866
|
+
example: "Content-Encoding: gzip",
|
|
867
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding",
|
|
868
|
+
standard: true
|
|
869
|
+
},
|
|
870
|
+
{
|
|
871
|
+
name: "Content-Language",
|
|
872
|
+
category: "response",
|
|
873
|
+
description: "Describes the language(s) intended for the audience of the resource.",
|
|
874
|
+
example: "Content-Language: en-US",
|
|
875
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Language",
|
|
876
|
+
standard: true
|
|
877
|
+
},
|
|
878
|
+
{
|
|
879
|
+
name: "Content-Location",
|
|
880
|
+
category: "response",
|
|
881
|
+
description: "Indicates an alternate location for the returned data.",
|
|
882
|
+
example: "Content-Location: /documents/foo.json",
|
|
883
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Location",
|
|
884
|
+
standard: true
|
|
885
|
+
},
|
|
886
|
+
{
|
|
887
|
+
name: "Content-MD5",
|
|
888
|
+
category: "response",
|
|
889
|
+
description: "A Base64-encoded binary MD5 sum of the content of the message body.",
|
|
890
|
+
example: "Content-MD5: Q2hlY2sgSW50ZWdyaXR5IQ==",
|
|
891
|
+
standard: false
|
|
892
|
+
},
|
|
893
|
+
{
|
|
894
|
+
name: "Content-Range",
|
|
895
|
+
category: "response",
|
|
896
|
+
description: "Indicates where in a full body message a partial message belongs.",
|
|
897
|
+
example: "Content-Range: bytes 200-1000/67589",
|
|
898
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range",
|
|
899
|
+
standard: true
|
|
900
|
+
},
|
|
901
|
+
{
|
|
902
|
+
name: "Date",
|
|
903
|
+
category: "response",
|
|
904
|
+
description: "Contains the date and time at which the message was originated.",
|
|
905
|
+
example: "Date: Wed, 21 Oct 2015 07:28:00 GMT",
|
|
906
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Date",
|
|
907
|
+
standard: true
|
|
908
|
+
},
|
|
909
|
+
{
|
|
910
|
+
name: "Link",
|
|
911
|
+
category: "response",
|
|
912
|
+
description: "Provides a means for serializing one or more links in HTTP headers.",
|
|
913
|
+
example: 'Link: <https://example.com>; rel="preconnect"',
|
|
914
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link",
|
|
915
|
+
standard: true
|
|
916
|
+
},
|
|
917
|
+
{
|
|
918
|
+
name: "Location",
|
|
919
|
+
category: "response",
|
|
920
|
+
description: "Indicates the URL to redirect a page to.",
|
|
921
|
+
example: "Location: https://www.example.com/",
|
|
922
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location",
|
|
923
|
+
standard: true
|
|
924
|
+
},
|
|
925
|
+
{
|
|
926
|
+
name: "Proxy-Authenticate",
|
|
927
|
+
category: "response",
|
|
928
|
+
description: "Defines the authentication method that should be used to gain access to a resource behind a proxy server.",
|
|
929
|
+
example: 'Proxy-Authenticate: Basic realm="Access to the internal site"',
|
|
930
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Proxy-Authenticate",
|
|
931
|
+
standard: true
|
|
932
|
+
},
|
|
933
|
+
{
|
|
934
|
+
name: "Retry-After",
|
|
935
|
+
category: "response",
|
|
936
|
+
description: "Indicates how long the user agent should wait before making a follow-up request.",
|
|
937
|
+
example: "Retry-After: 120",
|
|
938
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After",
|
|
939
|
+
standard: true
|
|
940
|
+
},
|
|
941
|
+
{
|
|
942
|
+
name: "Server",
|
|
943
|
+
category: "response",
|
|
944
|
+
description: "Contains information about the software used by the origin server to handle the request.",
|
|
945
|
+
example: "Server: Apache/2.4.1 (Unix)",
|
|
946
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Server",
|
|
947
|
+
standard: true
|
|
948
|
+
},
|
|
949
|
+
{
|
|
950
|
+
name: "Set-Cookie",
|
|
951
|
+
category: "response",
|
|
952
|
+
description: "Sends a cookie from the server to the user agent.",
|
|
953
|
+
example: "Set-Cookie: session_id=abc123; Path=/; HttpOnly; Secure; SameSite=Strict",
|
|
954
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie",
|
|
955
|
+
standard: true
|
|
956
|
+
},
|
|
957
|
+
{
|
|
958
|
+
name: "Trailer",
|
|
959
|
+
category: "response",
|
|
960
|
+
description: "Allows the sender to include additional fields at the end of chunked messages.",
|
|
961
|
+
example: "Trailer: Expires",
|
|
962
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Trailer",
|
|
963
|
+
standard: true
|
|
964
|
+
},
|
|
965
|
+
{
|
|
966
|
+
name: "WWW-Authenticate",
|
|
967
|
+
category: "response",
|
|
968
|
+
description: "Defines the authentication method that should be used to gain access to a resource.",
|
|
969
|
+
example: 'WWW-Authenticate: Basic realm="Access to the staging site", charset="UTF-8"',
|
|
970
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/WWW-Authenticate",
|
|
971
|
+
standard: true
|
|
972
|
+
},
|
|
973
|
+
{
|
|
974
|
+
name: "Warning",
|
|
975
|
+
category: "response",
|
|
976
|
+
description: "Contains information about possible problems with the status of the message.",
|
|
977
|
+
example: 'Warning: 112 - "cache down" "Wed, 21 Oct 2015 07:28:00 GMT"',
|
|
978
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Warning",
|
|
979
|
+
standard: true
|
|
980
|
+
},
|
|
981
|
+
{
|
|
982
|
+
name: "Content-Length",
|
|
983
|
+
category: "both",
|
|
984
|
+
description: "Indicates the size of the message body, in bytes, sent to the recipient.",
|
|
985
|
+
example: "Content-Length: 3495",
|
|
986
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Length",
|
|
987
|
+
standard: true
|
|
988
|
+
},
|
|
989
|
+
{
|
|
990
|
+
name: "Content-Type",
|
|
991
|
+
category: "both",
|
|
992
|
+
description: "Indicates the original media type of the resource prior to any content encoding applied for sending.",
|
|
993
|
+
example: "Content-Type: application/json; charset=utf-8",
|
|
994
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type",
|
|
995
|
+
standard: true
|
|
996
|
+
},
|
|
997
|
+
{
|
|
998
|
+
name: "Transfer-Encoding",
|
|
999
|
+
category: "both",
|
|
1000
|
+
description: "Specifies the form of encoding used to safely transfer the payload body to the user.",
|
|
1001
|
+
example: "Transfer-Encoding: chunked",
|
|
1002
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Transfer-Encoding",
|
|
1003
|
+
standard: true
|
|
1004
|
+
},
|
|
1005
|
+
{
|
|
1006
|
+
name: "Via",
|
|
1007
|
+
category: "both",
|
|
1008
|
+
description: "Added by proxies, both forward and reverse proxies, and can appear in request headers and response headers.",
|
|
1009
|
+
example: "Via: 1.1 vegur",
|
|
1010
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Via",
|
|
1011
|
+
standard: true
|
|
1012
|
+
},
|
|
1013
|
+
{
|
|
1014
|
+
name: "Cache-Control",
|
|
1015
|
+
category: "caching",
|
|
1016
|
+
description: "Holds directives (instructions) in both requests and responses that control caching in browsers and shared caches.",
|
|
1017
|
+
example: "Cache-Control: max-age=3600, must-revalidate",
|
|
1018
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control",
|
|
1019
|
+
standard: true
|
|
1020
|
+
},
|
|
1021
|
+
{
|
|
1022
|
+
name: "ETag",
|
|
1023
|
+
category: "caching",
|
|
1024
|
+
description: "A unique identifier assigned by a web server to a specific version of a resource found at a URL.",
|
|
1025
|
+
example: 'ETag: "737060cd8c284d8af7ad3082f209582d"',
|
|
1026
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag",
|
|
1027
|
+
standard: true
|
|
1028
|
+
},
|
|
1029
|
+
{
|
|
1030
|
+
name: "Expires",
|
|
1031
|
+
category: "caching",
|
|
1032
|
+
description: "Contains the date/time after which the response is considered stale.",
|
|
1033
|
+
example: "Expires: Wed, 21 Oct 2025 07:28:00 GMT",
|
|
1034
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expires",
|
|
1035
|
+
standard: true
|
|
1036
|
+
},
|
|
1037
|
+
{
|
|
1038
|
+
name: "Last-Modified",
|
|
1039
|
+
category: "caching",
|
|
1040
|
+
description: "Contains the date and time at which the origin server believes the resource was last modified.",
|
|
1041
|
+
example: "Last-Modified: Wed, 21 Oct 2015 07:28:00 GMT",
|
|
1042
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Last-Modified",
|
|
1043
|
+
standard: true
|
|
1044
|
+
},
|
|
1045
|
+
{
|
|
1046
|
+
name: "Pragma",
|
|
1047
|
+
category: "caching",
|
|
1048
|
+
description: "Implementation-specific header that may have various effects along the request-response chain.",
|
|
1049
|
+
example: "Pragma: no-cache",
|
|
1050
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Pragma",
|
|
1051
|
+
standard: true
|
|
1052
|
+
},
|
|
1053
|
+
{
|
|
1054
|
+
name: "Vary",
|
|
1055
|
+
category: "caching",
|
|
1056
|
+
description: "Determines how to match future request headers to decide whether a cached response can be used.",
|
|
1057
|
+
example: "Vary: Accept-Encoding, Accept-Language",
|
|
1058
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Vary",
|
|
1059
|
+
standard: true
|
|
1060
|
+
},
|
|
1061
|
+
{
|
|
1062
|
+
name: "Content-Security-Policy",
|
|
1063
|
+
category: "security",
|
|
1064
|
+
description: "Controls resources the user agent is allowed to load for a given page.",
|
|
1065
|
+
example: "Content-Security-Policy: default-src 'self'; script-src 'self' https://trusted.cdn.com",
|
|
1066
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy",
|
|
1067
|
+
standard: true
|
|
1068
|
+
},
|
|
1069
|
+
{
|
|
1070
|
+
name: "Strict-Transport-Security",
|
|
1071
|
+
category: "security",
|
|
1072
|
+
description: "Informs browsers that the site should only be accessed using HTTPS, and that any future attempts to access it using HTTP should automatically be converted to HTTPS.",
|
|
1073
|
+
example: "Strict-Transport-Security: max-age=63072000; includeSubDomains; preload",
|
|
1074
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security",
|
|
1075
|
+
standard: true
|
|
1076
|
+
},
|
|
1077
|
+
{
|
|
1078
|
+
name: "X-Content-Type-Options",
|
|
1079
|
+
category: "security",
|
|
1080
|
+
description: "Indicates that the MIME types advertised in the Content-Type headers should be respected and not changed.",
|
|
1081
|
+
example: "X-Content-Type-Options: nosniff",
|
|
1082
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options",
|
|
1083
|
+
standard: false
|
|
1084
|
+
},
|
|
1085
|
+
{
|
|
1086
|
+
name: "X-Frame-Options",
|
|
1087
|
+
category: "security",
|
|
1088
|
+
description: "Indicates whether a browser should be allowed to render a page in a frame, iframe, embed, or object.",
|
|
1089
|
+
example: "X-Frame-Options: DENY",
|
|
1090
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options",
|
|
1091
|
+
standard: false
|
|
1092
|
+
},
|
|
1093
|
+
{
|
|
1094
|
+
name: "X-XSS-Protection",
|
|
1095
|
+
category: "security",
|
|
1096
|
+
description: "Enables cross-site scripting filtering in older browsers that do not support CSP.",
|
|
1097
|
+
example: "X-XSS-Protection: 1; mode=block",
|
|
1098
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection",
|
|
1099
|
+
standard: false
|
|
1100
|
+
},
|
|
1101
|
+
{
|
|
1102
|
+
name: "Permissions-Policy",
|
|
1103
|
+
category: "security",
|
|
1104
|
+
description: "Provides a mechanism to allow and deny the use of browser features in its own frame and in iframes that it embeds.",
|
|
1105
|
+
example: "Permissions-Policy: camera=(), microphone=(), geolocation=(self)",
|
|
1106
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy",
|
|
1107
|
+
standard: true
|
|
1108
|
+
},
|
|
1109
|
+
{
|
|
1110
|
+
name: "Referrer-Policy",
|
|
1111
|
+
category: "security",
|
|
1112
|
+
description: "Controls how much referrer information should be included with requests.",
|
|
1113
|
+
example: "Referrer-Policy: strict-origin-when-cross-origin",
|
|
1114
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy",
|
|
1115
|
+
standard: true
|
|
1116
|
+
},
|
|
1117
|
+
{
|
|
1118
|
+
name: "Cross-Origin-Embedder-Policy",
|
|
1119
|
+
category: "security",
|
|
1120
|
+
description: "Prevents a document from loading any cross-origin resources that do not explicitly grant the document permission.",
|
|
1121
|
+
example: "Cross-Origin-Embedder-Policy: require-corp",
|
|
1122
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Embedder-Policy",
|
|
1123
|
+
standard: true
|
|
1124
|
+
},
|
|
1125
|
+
{
|
|
1126
|
+
name: "Cross-Origin-Opener-Policy",
|
|
1127
|
+
category: "security",
|
|
1128
|
+
description: "Allows you to ensure a top-level document does not share a browsing context group with cross-origin documents.",
|
|
1129
|
+
example: "Cross-Origin-Opener-Policy: same-origin",
|
|
1130
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Opener-Policy",
|
|
1131
|
+
standard: true
|
|
1132
|
+
},
|
|
1133
|
+
{
|
|
1134
|
+
name: "Cross-Origin-Resource-Policy",
|
|
1135
|
+
category: "security",
|
|
1136
|
+
description: "Conveys a desire that the browser blocks no-cors cross-origin/cross-site requests to the given resource.",
|
|
1137
|
+
example: "Cross-Origin-Resource-Policy: same-site",
|
|
1138
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Resource-Policy",
|
|
1139
|
+
standard: true
|
|
1140
|
+
},
|
|
1141
|
+
{
|
|
1142
|
+
name: "Access-Control-Allow-Origin",
|
|
1143
|
+
category: "cors",
|
|
1144
|
+
description: "Indicates whether the response can be shared with requesting code from the given origin.",
|
|
1145
|
+
example: "Access-Control-Allow-Origin: https://www.example.com",
|
|
1146
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin",
|
|
1147
|
+
standard: true
|
|
1148
|
+
},
|
|
1149
|
+
{
|
|
1150
|
+
name: "Access-Control-Allow-Methods",
|
|
1151
|
+
category: "cors",
|
|
1152
|
+
description: "Specifies the method or methods allowed when accessing the resource in response to a preflight request.",
|
|
1153
|
+
example: "Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS",
|
|
1154
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods",
|
|
1155
|
+
standard: true
|
|
1156
|
+
},
|
|
1157
|
+
{
|
|
1158
|
+
name: "Access-Control-Allow-Headers",
|
|
1159
|
+
category: "cors",
|
|
1160
|
+
description: "Indicates which HTTP headers can be used during the actual request.",
|
|
1161
|
+
example: "Access-Control-Allow-Headers: Content-Type, Authorization",
|
|
1162
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers",
|
|
1163
|
+
standard: true
|
|
1164
|
+
},
|
|
1165
|
+
{
|
|
1166
|
+
name: "Access-Control-Allow-Credentials",
|
|
1167
|
+
category: "cors",
|
|
1168
|
+
description: "Tells browsers whether to expose the response to the frontend JavaScript code when the request credentials mode is include.",
|
|
1169
|
+
example: "Access-Control-Allow-Credentials: true",
|
|
1170
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials",
|
|
1171
|
+
standard: true
|
|
1172
|
+
},
|
|
1173
|
+
{
|
|
1174
|
+
name: "Access-Control-Expose-Headers",
|
|
1175
|
+
category: "cors",
|
|
1176
|
+
description: "Indicates which headers can be exposed as part of the response by listing their names.",
|
|
1177
|
+
example: "Access-Control-Expose-Headers: Content-Length, X-Request-Id",
|
|
1178
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers",
|
|
1179
|
+
standard: true
|
|
1180
|
+
},
|
|
1181
|
+
{
|
|
1182
|
+
name: "Access-Control-Max-Age",
|
|
1183
|
+
category: "cors",
|
|
1184
|
+
description: "Indicates how long the results of a preflight request can be cached.",
|
|
1185
|
+
example: "Access-Control-Max-Age: 3600",
|
|
1186
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Max-Age",
|
|
1187
|
+
standard: true
|
|
1188
|
+
},
|
|
1189
|
+
{
|
|
1190
|
+
name: "Access-Control-Request-Headers",
|
|
1191
|
+
category: "cors",
|
|
1192
|
+
description: "Used when issuing a preflight request to let the server know which HTTP headers will be used when the actual request is made.",
|
|
1193
|
+
example: "Access-Control-Request-Headers: Content-Type, Authorization",
|
|
1194
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Request-Headers",
|
|
1195
|
+
standard: true
|
|
1196
|
+
},
|
|
1197
|
+
{
|
|
1198
|
+
name: "Access-Control-Request-Method",
|
|
1199
|
+
category: "cors",
|
|
1200
|
+
description: "Used when issuing a preflight request to let the server know which HTTP method will be used when the actual request is made.",
|
|
1201
|
+
example: "Access-Control-Request-Method: POST",
|
|
1202
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Request-Method",
|
|
1203
|
+
standard: true
|
|
1204
|
+
},
|
|
1205
|
+
{
|
|
1206
|
+
name: "X-Forwarded-For",
|
|
1207
|
+
category: "request",
|
|
1208
|
+
description: "Identifies the originating IP addresses of a client connecting to a web server through an HTTP proxy or load balancer.",
|
|
1209
|
+
example: "X-Forwarded-For: 203.0.113.195, 70.41.3.18",
|
|
1210
|
+
standard: false
|
|
1211
|
+
},
|
|
1212
|
+
{
|
|
1213
|
+
name: "X-Forwarded-Host",
|
|
1214
|
+
category: "request",
|
|
1215
|
+
description: "Identifies the original host requested by the client in the Host HTTP request header.",
|
|
1216
|
+
example: "X-Forwarded-Host: id.example.com",
|
|
1217
|
+
standard: false
|
|
1218
|
+
},
|
|
1219
|
+
{
|
|
1220
|
+
name: "X-Forwarded-Proto",
|
|
1221
|
+
category: "request",
|
|
1222
|
+
description: "Identifies the protocol that a client used to connect to the proxy or load balancer.",
|
|
1223
|
+
example: "X-Forwarded-Proto: https",
|
|
1224
|
+
standard: false
|
|
1225
|
+
},
|
|
1226
|
+
{
|
|
1227
|
+
name: "X-Request-ID",
|
|
1228
|
+
category: "request",
|
|
1229
|
+
description: "Allows identifying a request or session in logs, monitoring, and debugging.",
|
|
1230
|
+
example: "X-Request-ID: f058ebd6-02f7-4d3f-942e-904344e8cde5",
|
|
1231
|
+
standard: false
|
|
1232
|
+
},
|
|
1233
|
+
{
|
|
1234
|
+
name: "X-Real-IP",
|
|
1235
|
+
category: "request",
|
|
1236
|
+
description: "Contains the IP address of the client, set by a reverse proxy or load balancer.",
|
|
1237
|
+
example: "X-Real-IP: 203.0.113.195",
|
|
1238
|
+
standard: false
|
|
1239
|
+
},
|
|
1240
|
+
{
|
|
1241
|
+
name: "Forwarded",
|
|
1242
|
+
category: "request",
|
|
1243
|
+
description: "Contains information from the client-facing side of proxy servers that is altered or lost when a proxy is involved in the path of the request.",
|
|
1244
|
+
example: "Forwarded: for=192.0.2.60;proto=http;by=203.0.113.43;host=example.com",
|
|
1245
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Forwarded",
|
|
1246
|
+
standard: true
|
|
1247
|
+
},
|
|
1248
|
+
{
|
|
1249
|
+
name: "Sec-Fetch-Dest",
|
|
1250
|
+
category: "request",
|
|
1251
|
+
description: "Indicates the request destination, that is the initiator of the fetch request.",
|
|
1252
|
+
example: "Sec-Fetch-Dest: document",
|
|
1253
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-Fetch-Dest",
|
|
1254
|
+
standard: true
|
|
1255
|
+
},
|
|
1256
|
+
{
|
|
1257
|
+
name: "Sec-Fetch-Mode",
|
|
1258
|
+
category: "request",
|
|
1259
|
+
description: "Indicates the mode of the request.",
|
|
1260
|
+
example: "Sec-Fetch-Mode: navigate",
|
|
1261
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-Fetch-Mode",
|
|
1262
|
+
standard: true
|
|
1263
|
+
},
|
|
1264
|
+
{
|
|
1265
|
+
name: "Sec-Fetch-Site",
|
|
1266
|
+
category: "request",
|
|
1267
|
+
description: "Indicates the relationship between a request initiator origin and the origin of the resource.",
|
|
1268
|
+
example: "Sec-Fetch-Site: same-origin",
|
|
1269
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-Fetch-Site",
|
|
1270
|
+
standard: true
|
|
1271
|
+
},
|
|
1272
|
+
{
|
|
1273
|
+
name: "Sec-Fetch-User",
|
|
1274
|
+
category: "request",
|
|
1275
|
+
description: "Indicates whether a navigation request was triggered by user activation.",
|
|
1276
|
+
example: "Sec-Fetch-User: ?1",
|
|
1277
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-Fetch-User",
|
|
1278
|
+
standard: true
|
|
1279
|
+
},
|
|
1280
|
+
{
|
|
1281
|
+
name: "Content-Security-Policy-Report-Only",
|
|
1282
|
+
category: "security",
|
|
1283
|
+
description: "Allows web developers to experiment with policies by monitoring their effects without enforcing them.",
|
|
1284
|
+
example: "Content-Security-Policy-Report-Only: default-src 'self'; report-uri /csp-violation-report-endpoint/",
|
|
1285
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only",
|
|
1286
|
+
standard: true
|
|
1287
|
+
},
|
|
1288
|
+
{
|
|
1289
|
+
name: "Keep-Alive",
|
|
1290
|
+
category: "request",
|
|
1291
|
+
description: "Controls how long a persistent connection should stay open.",
|
|
1292
|
+
example: "Keep-Alive: timeout=5, max=1000",
|
|
1293
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Keep-Alive",
|
|
1294
|
+
standard: true
|
|
1295
|
+
},
|
|
1296
|
+
{
|
|
1297
|
+
name: "Alt-Svc",
|
|
1298
|
+
category: "response",
|
|
1299
|
+
description: "Used to advertise alternative services through which the same resource can be reached.",
|
|
1300
|
+
example: 'Alt-Svc: h2=":443"; ma=2592000',
|
|
1301
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Alt-Svc",
|
|
1302
|
+
standard: true
|
|
1303
|
+
},
|
|
1304
|
+
{
|
|
1305
|
+
name: "Clear-Site-Data",
|
|
1306
|
+
category: "response",
|
|
1307
|
+
description: "Clears browsing data (cookies, storage, cache) associated with the requesting website.",
|
|
1308
|
+
example: 'Clear-Site-Data: "cache", "cookies", "storage"',
|
|
1309
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Clear-Site-Data",
|
|
1310
|
+
standard: true
|
|
1311
|
+
},
|
|
1312
|
+
{
|
|
1313
|
+
name: "Timing-Allow-Origin",
|
|
1314
|
+
category: "response",
|
|
1315
|
+
description: "Specifies origins that are allowed to see values of attributes retrieved via features of the Resource Timing API.",
|
|
1316
|
+
example: "Timing-Allow-Origin: https://developer.mozilla.org",
|
|
1317
|
+
mdn: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Timing-Allow-Origin",
|
|
1318
|
+
standard: true
|
|
1319
|
+
}
|
|
1320
|
+
];
|
|
1321
|
+
function getHeader(name) {
|
|
1322
|
+
return HTTP_HEADERS.find((h) => h.name.toLowerCase() === name.toLowerCase());
|
|
1323
|
+
}
|
|
1324
|
+
function getHeadersByCategory(category) {
|
|
1325
|
+
return HTTP_HEADERS.filter((h) => h.category === category);
|
|
1326
|
+
}
|
|
1327
|
+
function getByCategory(category) {
|
|
1328
|
+
return getHeadersByCategory(category);
|
|
1329
|
+
}
|
|
1330
|
+
function searchHeaders(query) {
|
|
1331
|
+
if (query === "") return HTTP_HEADERS;
|
|
1332
|
+
const q = query.toLowerCase();
|
|
1333
|
+
return HTTP_HEADERS.filter(
|
|
1334
|
+
(h) => h.name.toLowerCase().includes(q) || h.description.toLowerCase().includes(q) || h.category.toLowerCase().includes(q)
|
|
1335
|
+
);
|
|
1336
|
+
}
|
|
1337
|
+
function validateHeaderName(name) {
|
|
1338
|
+
return /^[a-zA-Z][a-zA-Z0-9\-]*$/.test(name);
|
|
1339
|
+
}
|
|
1340
|
+
var VALID_CACHE_CONTROL_DIRECTIVES = /* @__PURE__ */ new Set([
|
|
1341
|
+
"max-age",
|
|
1342
|
+
"s-maxage",
|
|
1343
|
+
"no-cache",
|
|
1344
|
+
"no-store",
|
|
1345
|
+
"no-transform",
|
|
1346
|
+
"only-if-cached",
|
|
1347
|
+
"must-revalidate",
|
|
1348
|
+
"proxy-revalidate",
|
|
1349
|
+
"must-understand",
|
|
1350
|
+
"private",
|
|
1351
|
+
"public",
|
|
1352
|
+
"immutable",
|
|
1353
|
+
"stale-while-revalidate",
|
|
1354
|
+
"stale-if-error"
|
|
1355
|
+
]);
|
|
1356
|
+
function validateHeaderValue(name, value) {
|
|
1357
|
+
if (value.trim() === "") {
|
|
1358
|
+
return { valid: false };
|
|
1359
|
+
}
|
|
1360
|
+
const normalizedName = name.toLowerCase();
|
|
1361
|
+
if (normalizedName === "content-type") {
|
|
1362
|
+
if (!value.includes("/")) {
|
|
1363
|
+
return { valid: false };
|
|
1364
|
+
}
|
|
1365
|
+
const mediaType = value.split(";")[0].trim().toLowerCase();
|
|
1366
|
+
if (mediaType.startsWith("text/") && !value.toLowerCase().includes("charset")) {
|
|
1367
|
+
return { valid: true, warning: "text/* media types should specify a charset parameter" };
|
|
1368
|
+
}
|
|
1369
|
+
return { valid: true };
|
|
1370
|
+
}
|
|
1371
|
+
if (normalizedName === "cache-control") {
|
|
1372
|
+
const directives = value.split(",").map((d) => d.trim().split("=")[0].trim().toLowerCase());
|
|
1373
|
+
const unrecognized = directives.filter((d) => !VALID_CACHE_CONTROL_DIRECTIVES.has(d));
|
|
1374
|
+
if (unrecognized.length > 0) {
|
|
1375
|
+
return {
|
|
1376
|
+
valid: true,
|
|
1377
|
+
warning: `Unrecognized Cache-Control directive(s): ${unrecognized.join(", ")}`
|
|
1378
|
+
};
|
|
1379
|
+
}
|
|
1380
|
+
return { valid: true };
|
|
1381
|
+
}
|
|
1382
|
+
return { valid: true };
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
export { DNS_RECORD_TYPES, HTTP_HEADERS, STATUS_CODES, buildDnsQueryUrl, buildGeoUrl, buildMapUrl, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, network_exports, parseDnsResponse, parseGeoResponse, searchHeaders, searchStatusCodes, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue };
|