mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-12 14:19:00 +08:00
fix(map): do not remove query parameters from results (FIR-1015) (#1191)
* fix(map): do not remove query parameters from results * feat(map): add tests for query parameter handling
This commit is contained in:
parent
5cb2918368
commit
7ecbff3b20
@ -39,4 +39,24 @@ describe("Map tests", () => {
|
|||||||
expect(response.body.success).toBe(false);
|
expect(response.body.success).toBe(false);
|
||||||
expect(response.body.error).toBe("Request timed out");
|
expect(response.body.error).toBe("Request timed out");
|
||||||
}, 10000);
|
}, 10000);
|
||||||
|
|
||||||
|
it("handles query parameters correctly", async () => {
|
||||||
|
let response = await map({
|
||||||
|
url: "https://www.hfea.gov.uk",
|
||||||
|
sitemapOnly: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(response.statusCode).toBe(200);
|
||||||
|
expect(response.body.success).toBe(true);
|
||||||
|
expect(response.body.links.some(x => x.match(/^https:\/\/www\.hfea\.gov\.uk\/choose-a-clinic\/clinic-search\/results\/?\?options=\d+$/))).toBe(true);
|
||||||
|
|
||||||
|
response = await map({
|
||||||
|
url: "https://www.hfea.gov.uk",
|
||||||
|
ignoreSitemap: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(response.statusCode).toBe(200);
|
||||||
|
expect(response.body.success).toBe(true);
|
||||||
|
expect(response.body.links.some(x => x.match(/^https:\/\/www\.hfea\.gov\.uk\/choose-a-clinic\/clinic-search\/results\/?\?options=\d+$/))).toBe(true);
|
||||||
|
}, 300000); // TODO: mocks
|
||||||
});
|
});
|
||||||
|
@ -147,7 +147,7 @@ export const checkAndUpdateURLForMap = (url: string) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// remove any query params
|
// remove any query params
|
||||||
url = url.split("?")[0].trim();
|
// url = url.split("?")[0].trim();
|
||||||
|
|
||||||
return { urlObj: typedUrlObj, url: url };
|
return { urlObj: typedUrlObj, url: url };
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user