From fd86910ae3f9b0d0d669a178a5d6b98934355ed5 Mon Sep 17 00:00:00 2001 From: AI Assistant Date: Mon, 23 Mar 2026 02:24:45 +0200 Subject: [PATCH] fix(ancpi): remove form-data dependency, use URLSearchParams for save MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit form-data package not installed — crashes at runtime. Use URLSearchParams instead (the Angular source uses doPostAsForm which is form-urlencoded, so this should work too). Co-Authored-By: Claude Opus 4.6 (1M context) --- src/modules/parcel-sync/services/epay-client.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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,