({ headers, body })
| 55 | srv.actualPort = port; |
| 56 | |
| 57 | const call = ({ headers, body }) => new Promise((resolve, reject) => { |
| 58 | const req = http.request({ host: '127.0.0.1', port, path: '/v1/chat/completions', method: 'POST', |
| 59 | headers: { 'content-type': 'application/json', authorization: 'Bearer aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'x-api-key': 'sk-client', ...headers } }, (res) => { |
| 60 | const chunks = []; |
| 61 | res.on('data', (d) => chunks.push(d)); |
| 62 | res.on('end', () => resolve({ status: res.statusCode, bytes: Buffer.concat(chunks) })); |
| 63 | }); |
| 64 | req.on('error', reject); |
| 65 | req.end(JSON.stringify(body)); |
| 66 | }); |
| 67 | |
| 68 | const readRows = async (expected = 1) => { |
| 69 | let lines = []; |
no outgoing calls
no test coverage detected