From ad70c30be537fa4aa8283ae98331eb828c0a276b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20M=C3=B3ricz?= Date: Wed, 11 Sep 2024 20:31:58 +0200 Subject: [PATCH 1/2] fix(js-sdk): check at bad if --- apps/js-sdk/firecrawl/src/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/js-sdk/firecrawl/src/index.ts b/apps/js-sdk/firecrawl/src/index.ts index 6248789b..115e62e9 100644 --- a/apps/js-sdk/firecrawl/src/index.ts +++ b/apps/js-sdk/firecrawl/src/index.ts @@ -186,7 +186,7 @@ export default class FirecrawlApp { if (typeof apiKey !== "string") { throw new Error("No API key provided"); } - + this.apiKey = apiKey; this.apiUrl = apiUrl || "https://api.firecrawl.dev"; } @@ -346,9 +346,9 @@ export default class FirecrawlApp { `${this.apiUrl}/v1/crawl/${id}`, headers ); - if (response.status === 200 && getAllData) { + if (response.status === 200) { let allData = response.data.data; - if (response.data.status === "completed") { + if (getAllData && response.data.status === "completed") { let statusData = response.data if ("data" in statusData) { let data = statusData.data; From 5adfd74cc5a6e251d0ad6fc4bc4be7cc7cd6d04c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20M=C3=B3ricz?= Date: Wed, 11 Sep 2024 20:32:34 +0200 Subject: [PATCH 2/2] feat(js-sdk/test): add API_URL env var --- .../firecrawl/src/__tests__/v1/e2e_withAuth/index.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/js-sdk/firecrawl/src/__tests__/v1/e2e_withAuth/index.test.ts b/apps/js-sdk/firecrawl/src/__tests__/v1/e2e_withAuth/index.test.ts index 5eadd92e..98a52538 100644 --- a/apps/js-sdk/firecrawl/src/__tests__/v1/e2e_withAuth/index.test.ts +++ b/apps/js-sdk/firecrawl/src/__tests__/v1/e2e_withAuth/index.test.ts @@ -6,7 +6,7 @@ import { describe, test, expect } from '@jest/globals'; dotenv.config(); const TEST_API_KEY = process.env.TEST_API_KEY; -const API_URL = "https://api.firecrawl.dev"; +const API_URL = process.env.API_URL ?? "https://api.firecrawl.dev"; describe('FirecrawlApp E2E Tests', () => { test.concurrent('should throw error for no API key', async () => {