MCPcopy Create free account
hub / github.com/EvoMap/evolver / rawRequest

Function rawRequest

test/proxyStreaming.test.js:12–34  ·  view source on GitHub ↗
(url, token)

Source from the content-addressed store, hash-verified

10const { ProxyHttpServer } = require('../src/proxy/server/http');
11
12function rawRequest(url, token) {
13 return new Promise((resolve, reject) => {
14 const u = new URL(url);
15 const req = http.request({
16 hostname: u.hostname,
17 port: u.port,
18 path: u.pathname,
19 method: 'POST',
20 headers: { 'Authorization': 'Bearer ' + token, 'Content-Type': 'application/json', 'Content-Length': 2 },
21 }, (res) => {
22 const chunks = [];
23 res.on('data', (c) => chunks.push(c));
24 res.on('end', () => resolve({
25 status: res.statusCode,
26 headers: res.headers,
27 body: Buffer.concat(chunks).toString(),
28 }));
29 });
30 req.on('error', reject);
31 req.write('{}');
32 req.end();
33 });
34}
35
36describe('ProxyHttpServer streaming pass-through', () => {
37 let server, baseUrl, token;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected