diff --git a/src/utils.ts b/src/utils.ts index 488cf80..99b99d2 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -113,13 +113,17 @@ export async function cancelPrint(mfpBaseUrl: string, ref: string): Promise { +export async function requestReport( + mfpBaseUrl: string, + spec: MFPSpec, + replacer?: (key: string, value: any) => any | (string | number)[], +): Promise { const report = await fetch(`${mfpBaseUrl}/report.${spec.format}`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, - body: JSON.stringify(spec), + body: JSON.stringify(spec, replacer), }); return await report.json(); }