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

Function rawPost

test/v1Responses.test.js:15–43  ·  view source on GitHub ↗
(url, token, body, headers = {})

Source from the content-addressed store, hash-verified

13const { EvoMapProxy } = require('../src/proxy');
14
15function rawPost(url, token, body, headers = {}) {
16 return new Promise((resolve, reject) => {
17 const u = new URL(url);
18 const payload = JSON.stringify(body || {});
19 const req = http.request({
20 hostname: u.hostname,
21 port: u.port,
22 path: u.pathname,
23 method: 'POST',
24 headers: {
25 'Authorization': 'Bearer ' + token,
26 'Content-Type': 'application/json',
27 'Content-Length': Buffer.byteLength(payload),
28 ...headers,
29 },
30 }, (res) => {
31 const chunks = [];
32 res.on('data', (c) => chunks.push(c));
33 res.on('end', () => resolve({
34 status: res.statusCode,
35 headers: res.headers,
36 body: Buffer.concat(chunks).toString(),
37 }));
38 });
39 req.on('error', reject);
40 req.write(payload);
41 req.end();
42 });
43}
44
45describe('POST /v1/responses — Codex/OpenAI passthrough', () => {
46 let server, baseUrl, token, captured;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected