MCPcopy Create free account
hub / github.com/MCSManager/MCSManager / getCommonHeaders

Function getCommonHeaders

daemon/src/common/network.ts:5–24  ·  view source on GitHub ↗
(url?: string)

Source from the content-addressed store, hash-verified

3 * Provides a standardized set of headers for all outward network requests.
4 */
5export function getCommonHeaders(url?: string) {
6 const headers: Record<string, string> = {
7 "User-Agent":
8 "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36",
9 Accept: "*/*",
10 "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8",
11 Connection: "keep-alive"
12 };
13
14 if (url) {
15 try {
16 const urlObj = new URL(url);
17 headers["Referer"] = urlObj.origin;
18 } catch (e) {
19 // Ignore invalid URL
20 }
21 }
22
23 return headers;
24}

Callers 4

downloadSteamFunction · 0.90
requestWithRetryMethod · 0.90
downloadFileToLocalFileFunction · 0.90
downloadMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected