K6 FormData outputs different that regular fromdata

I have had the same request done through another tool with the same parameters but I used from data imported from form-data - npm instead of the K6 library import { FormData } from "https://jslib.k6.io/formdata/0.0.2/index.js"

I am getting a response that the backend could not recognize the sent file because maybe it is using different formatting I don’t know to be honest.

import { FormData } from "https://jslib.k6.io/formdata/0.0.2/index.js";

let importFile = open("../fixtures/importFile.dfxp");

 let params = {
    headers: {
      Authorization: "Bearer " + access_token,

      "Content-Type": "multipart/form-data",
    },
    timeout: 300000,
  };
  console.log(`VU: ${__VU}  -  ITER: ${__ITER}`);

  let url = `${myOptions.ceBaseURL}/projects/${projectId}/track_versions/${track_version}/import_dfxp`;
  const data = new FormData();
  data.append("projectId", projectId);
  data.append("import_type", "DFXP");
  data.append("file", importFile, "test.dfxp");
  // data.append("file", http.file(importFile, "test.pxtt", "bin"));

  const res = http.post(url, data, params);

  console.log("res.body", res.body);

Hi @AhmadGafar
Welcome to the forum. FormData in k6 jslib comes with specific usage requirements:

Please note that you should be sending data.body() and adding boundary to the header. Perhaps those modifications to your script would help?