diff --git a/src/modules/parcel-sync/services/epay-client.ts b/src/modules/parcel-sync/services/epay-client.ts index 5fd2084..8674210 100644 --- a/src/modules/parcel-sync/services/epay-client.ts +++ b/src/modules/parcel-sync/services/epay-client.ts @@ -19,7 +19,6 @@ import axios, { type AxiosInstance } from "axios"; import crypto from "crypto"; import { wrapper } from "axios-cookiejar-support"; import { CookieJar } from "tough-cookie"; -import FormData from "form-data"; import type { EpayCartResponse, EpaySearchResult, @@ -400,16 +399,18 @@ export class EpayClient { configurationUrl: "http://www.google.com", }; - const form = new FormData(); - form.append("reqType", "saveProductMetadataForBasketItem"); - form.append("productMetadataJSON", JSON.stringify(metadata)); + // Use URLSearchParams instead of multipart FormData + // (axios + cookie-jar has issues with native FormData) + const form = new URLSearchParams(); + form.set("reqType", "saveProductMetadataForBasketItem"); + form.set("productMetadataJSON", JSON.stringify(metadata)); const response = await this.client.post( `${BASE_URL}/EpayJsonInterceptor.action`, - form, + form.toString(), { headers: { - ...form.getHeaders(), + "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", "X-Requested-With": "XMLHttpRequest", }, timeout: DEFAULT_TIMEOUT_MS,