headers的修改

阅读次数 37

我想要修改这个请求头,貌似没有任何效果,打印出的请求头确实这样的,请问这个是为什么 cache-control: private,no-cache, no-store pragma: no-cache content-type: text/plain; charset=utf-8
server: Microsoft-IIS/10.0
x-content-type-options: nosniff
access-control-allow-origin: *
access-control-allow-methods: GET,PUT,POST,DELETE,OPTIONS
access-control-allow-headers: Content-Type
x-xss-protection: 1; mode=block
strict-transport-security: max-age=31536000; includeSubDomains
date: Sat, 06 Jul 2024 05:45:42 GMT
content-length: 140

    const longitude = (parseFloat(user.longitude) + (Math.random() * 0.0001 - 0.00005)).toFixed(6);
    const latitude = (parseFloat(user.latitude) + (Math.random() * 0.0001 - 0.00005)).toFixed(6);
    const data = {
        'dtype': 1,
        'uid': uid,
        'address': user.address,
        'phonetype': user.deviceModel,
        'probability': 0,
        'longitude': longitude,
        'latitude': latitude
    };
    const Sign = Crypto.createHmac("sha256", 'Anything_2023').update( JSON.stringify(data) + token).digest('hex')
    const header = {
        "os": "android",
        "phone": user.deviceModel,
        "appversion": "65",
        "sign": Sign,
        "timestamp": Date.now().toString(),
        "token": token,
        "cl_ip": `192.168.31.${Math.floor(Math.random() * (200 - 10 + 1)) + 10}`,
        "content-type": "application/json",
        "Content-Length": String(JSON.stringify(data).length),
        // "accept-encoding": "gzip, deflate",
        "user-agent": "okhttp/3.14.9"
    };
    const url = 'https://sxbaapp.dxtxl.com/api/clockindaily20221202.ashx';
const response = HTTP.post(url, JSON.stringify(data), { headers: header })
console.info(response.headers)

0 Answers