Skip to content

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 Upadhyay2edb5ec2100a
diff --git a/ts/packages/cli/scripts/mock-toolkits-server.ts b/ts/packages/cli/scripts/mock-toolkits-server.ts
index ebba8ffc4..679e53016 100644
--- a/ts/packages/cli/scripts/mock-toolkits-server.ts
+++ b/ts/packages/cli/scripts/mock-toolkits-server.ts
@@ -94,10 +94,11 @@ export async function startMockToolkitsListServer(options?: {
const server = createServer((req, res) => {
const url = new URL(req.url ?? '/', `http://${req.headers.host ?? '127.0.0.1'}`);
- requests.push(`${req.method ?? 'GET'} ${url.pathname}${url.search}`);
+ const method = req.method ?? 'GET';
+ requests.push(`${method} ${url.pathname}${url.search}`);
if (
- (req.method ?? 'GET') === 'GET' &&
+ method === 'GET' &&
(url.pathname === '/api/v3/toolkits' || url.pathname === '/api/v3.1/toolkits')
) {
const items = matchingToolkits(url.searchParams.get('search')).slice(0, parseLimit(req));
@@ -112,7 +113,7 @@ export async function startMockToolkitsListServer(options?: {
}
if (
- (req.method ?? 'GET') === 'GET' &&
+ method === 'GET' &&
(url.pathname === '/api/v3/toolkits/gmail' || url.pathname === '/api/v3.1/toolkits/gmail')
) {
sendJson(res, 200, GMAIL_TOOLKIT_DETAILED);
@@ -120,7 +121,7 @@ export async function startMockToolkitsListServer(options?: {
}
if (
- (req.method ?? 'GET') === 'GET' &&
+ method === 'GET' &&
(url.pathname.startsWith('/api/v3/toolkits/') ||
url.pathname.startsWith('/api/v3.1/toolkits/'))
) {
@@ -130,13 +131,13 @@ export async function startMockToolkitsListServer(options?: {
return;
}
- if ((req.method ?? 'GET') === 'POST' && url.pathname === '/api/v3/cli/analytics') {
+ if (method === 'POST' && url.pathname === '/api/v3/cli/analytics') {
sendJson(res, 204, {});
return;
}
sendJson(res, 404, {
- error: `Unhandled mock route: ${req.method ?? 'GET'} ${url.pathname}`,
+ error: `Unhandled mock route: ${method} ${url.pathname}`,
});
});