Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Address mock toolkit server method nit
Dhawal Upadhyay committed
May 6, 2026 at 15:55 UTC
2edb5ec2100af65921946f2b5a23c7faf6024056
1 file changed
+7
-6
ts/packages/cli/scripts/mock-toolkits-server.ts
+7
-6
@@ -94,10 +94,11 @@ export async function startMockToolkitsListServer(options?: {
94
95
const server = createServer((req, res) => {
96
const url = new URL(req.url ?? '/', `http://${req.headers.host ?? '127.0.0.1'}`);
97
- requests.push(`${req.method ?? 'GET'} ${url.pathname}${url.search}`);
97
+ const method = req.method ?? 'GET';
98
+ requests.push(`${method} ${url.pathname}${url.search}`);
99
100
if (
100
- (req.method ?? 'GET') === 'GET' &&
101
+ method === 'GET' &&
102
(url.pathname === '/api/v3/toolkits' || url.pathname === '/api/v3.1/toolkits')
103
) {
104
const items = matchingToolkits(url.searchParams.get('search')).slice(0, parseLimit(req));
@@ -112,7 +113,7 @@ export async function startMockToolkitsListServer(options?: {
113
}
114
115
if (
115
- (req.method ?? 'GET') === 'GET' &&
116
+ method === 'GET' &&
117
(url.pathname === '/api/v3/toolkits/gmail' || url.pathname === '/api/v3.1/toolkits/gmail')
118
) {
119
sendJson(res, 200, GMAIL_TOOLKIT_DETAILED);
@@ -120,7 +121,7 @@ export async function startMockToolkitsListServer(options?: {
121
}
122
123
if (
123
- (req.method ?? 'GET') === 'GET' &&
124
+ method === 'GET' &&
125
(url.pathname.startsWith('/api/v3/toolkits/') ||
126
url.pathname.startsWith('/api/v3.1/toolkits/'))
127
) {
@@ -130,13 +131,13 @@ export async function startMockToolkitsListServer(options?: {
131
return;
132
}
133
133
- if ((req.method ?? 'GET') === 'POST' && url.pathname === '/api/v3/cli/analytics') {
134
+ if (method === 'POST' && url.pathname === '/api/v3/cli/analytics') {
135
sendJson(res, 204, {});
136
return;
137
}
138
139
sendJson(res, 404, {
139
- error: `Unhandled mock route: ${req.method ?? 'GET'} ${url.pathname}`,
140
+ error: `Unhandled mock route: ${method} ${url.pathname}`,
141
});
142
});
143