-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-interceptor.js
More file actions
1 lines (1 loc) · 912 Bytes
/
test-interceptor.js
File metadata and controls
1 lines (1 loc) · 912 Bytes
1
const http = require('http'); const https = require('https'); http.createServer((req, res) => { let body = ''; req.on('data', chunk => { body += chunk; }); req.on('end', () => { const parsed = JSON.parse(body); const token = req.headers.authorization; const wrapper = { project: 'rising-fact-p41fc', requestType: 'agent', request: parsed }; const options = { hostname: 'cloudcode-pa.googleapis.com', port: 443, path: '/v1internal:streamGenerateContent?alt=sse', method: 'POST', headers: { 'Authorization': token, 'Content-Type': 'application/json', 'User-Agent': 'antigravity/1.18.3 windows/amd64', 'Client-Metadata': JSON.stringify({ideType:'ANTIGRAVITY',platform:'WINDOWS',pluginType:'GEMINI'}) } }; const proxyReq = https.request(options, proxyRes => { res.writeHead(proxyRes.statusCode, proxyRes.headers); proxyRes.pipe(res); }); proxyReq.write(JSON.stringify(wrapper)); proxyReq.end(); }); }).listen(4001);