A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!
TypeScript agent-skillsaidsh-pluginhacktoberfestjavascriptmcp-serverreactresume-builderself-hostedtypescript
fix(api): support HTTPS job posting fetches (#3267)
cielhaidird4cf260aed7b
diff --git a/packages/api/src/features/applications/ai.test.ts b/packages/api/src/features/applications/ai.test.tsindex 2eee5628d..9b294217a 100644--- a/packages/api/src/features/applications/ai.test.ts+++ b/packages/api/src/features/applications/ai.test.ts@@ -104,6 +104,27 @@ describe("fetchJobPostingText", () => {await expect(fetchJobPostingText("https://jobs.example/posting")).resolves.toBe("Senior Engineer");expect(pinnedAddress).toBe("93.184.216.34");});++ it("supports Node lookup calls with all=true", async () => {+ lookupMock.mockResolvedValue([{ address: "93.184.216.34", family: 4 }]);+ let lookupResult: unknown;+ requestMock.mockImplementation((_url, options, callback) => {+ options.lookup("jobs.example", { all: true }, (_error: Error | null, result: unknown) => {+ lookupResult = result;+ });+ const response = Readable.from([Buffer.from("<html><body>Senior Engineer</body></html>")]) as Readable & {+ statusCode: number;+ headers: Record<string, string>;+ };+ response.statusCode = 200;+ response.headers = { "content-type": "text/html" };+ callback(response);+ return { on: vi.fn(), end: vi.fn() };+ });++ await expect(fetchJobPostingText("https://jobs.example/posting")).resolves.toBe("Senior Engineer");+ expect(lookupResult).toEqual([{ address: "93.184.216.34", family: 4 }]);+ });});describe("autofillInputSchema", () => {diff --git a/packages/api/src/features/applications/ai.ts b/packages/api/src/features/applications/ai.tsindex 89b23fd27..156a9b93c 100644--- a/packages/api/src/features/applications/ai.ts+++ b/packages/api/src/features/applications/ai.ts@@ -163,7 +163,14 @@ function requestJobPosting(parsed: URL, address: ValidatedAddress, signal: Abortaccept: "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","accept-language": "en-US,en;q=0.9",},- lookup: (_hostname, _options, callback) => callback(null, address.address, address.family),+ lookup: (_hostname, options, callback) => {+ if (options.all) {+ callback(null, [address]);+ return;+ }++ callback(null, address.address, address.family);+ },},resolve,);