cc-libs/tools/mcp-bridge/test-integration/lua/opencode-proxy-check.lua

16 lines
515 B
Lua

-- Drives the real libhttpws transport against the bridge opencode proxy.
-- Usage: opencode-proxy-check <ws-proxy-url>
local createHttpWs = require('/apis/libhttpws');
local args = { ... };
local url = args[1];
local client = createHttpWs({ bridgeUrl = url, receiveTimeout = 10 });
local body, code = client.postJson({ url = '' }, '/session/ses_x/message', {
parts = { { type = 'text', text = 'ping' } },
});
print('STATUS=' .. tostring(code));
print('BODY=' .. tostring(body));
client.close();
os.shutdown();