Skip to content

Commit

Permalink
Add default headers
Browse files Browse the repository at this point in the history
  • Loading branch information
dcramer committed Aug 23, 2024
1 parent 49befbe commit 8ba7495
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/server/src/worker/jobs/capturePriceImage.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { defaultHeaders } from "@peated/server/constants";
import { db } from "@peated/server/db";
import { storePrices } from "@peated/server/db/schema";
import { compressAndResizeImage, storeFile } from "@peated/server/lib/uploads";
import { eq } from "drizzle-orm";
import { get } from "http";
import { Readable } from "stream";

async function fetchAndStoreImage(imageUrl: string): Promise<string | null> {
const filename = imageUrl.split("/").pop() || "image";

console.log(`Fetching image [${imageUrl}]`);
const req = await fetch(imageUrl);
const req = await fetch(imageUrl, { headers: defaultHeaders(imageUrl) });
if (!req.body) return null;
const file = Readable.fromWeb(req.body as any);

Expand Down

0 comments on commit 8ba7495

Please sign in to comment.