// 测试速率限制 const http = require('http') const API = 'http://localhost:8976/api/v1/ingest/private_clipboard' function post(path, body) { return new Promise((resolve, reject) => { const data = JSON.stringify(body) const req = http.request(`${API}${path}`, { method: 'POST', headers: { 'X-API-Id': 'private_clipboard', 'X-API-Key': 'pcb_nuS0qf-W63qcvAPsrG5ePA', 'Content-Type': 'application/json; charset=utf-8', 'Content-Length': Buffer.byteLength(data) } }, (res) => { let b = '' res.on('data', d => b += d) res.on('end', () => resolve({ status: res.statusCode, body: b })) }) req.on('error', reject) req.write(data) req.end() }) } async function run() { console.log('开始发送 65 次请求...') let limited = false for (let i = 1; i <= 65; i++) { const r = await post('/text', { text: `ratelimit-${i}` }) if (r.status === 429) { console.log(`第 ${i} 次请求被限制 (429)`) console.log(`响应: ${r.body}`) limited = true break } } if (!limited) console.log('❌ 65 次请求全部通过,速率限制未生效') else console.log('✅ 速率限制生效') } run()