Formdata in upper version of 0.43.1

Hi, we see that in upper versions when we use a post in this way:

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

      let formData = new FormData()
      let correlationId = uuidv4();

      formData.append('correlationId', correlationId);
      formData.append('activityCorrelationId', element.activityCorrelationId);
      formData.append('channelCorrelationId', element.channelCorrelationId);
      formData.append('file', http.file(zipFiles[i], element.file));
      i++;
      let response = http.post(http.url`${config.baseImportiaUrl}api/integrationFiles`, formData.body(), {
          headers: {
                    'Authorization': `${token}`,
                    'context': `${JSON.stringify(element.context)}`,
                    'Content-Type': `multipart/form-data; boundary=` + formData.boundary,
                    'Ocp-Apim-Subscription-Key': `${config.apimSubscriptionKey}`
                },
                tags: {
                    service: 'integrationFiles'
                }
            });
      check(response, { 'Integration Files Code 2xx Successful': (r) => r.status >= 200 && r.status <= 226 });     

Always returns a 400 Bad Request. But in version 0.43.1 all is ok.

Can you help us? We want to use the latest version. Maybe @codebien ? Thanks in advance.

Hi @Pablez

Sorry for the late reply. Did you happen to find a solution to your issue in the meantime?

Otherwise, could you let me know which exact version you’re using to run your tests, as a quick pass on the release notes doesn’t help me spot any changes to FormData that might impact you.

Could you also please run k6 with http debug, and compare the requests sent by the version of k6 that works for you, and the one that doesn’t, and let us know if you spot differences? That would help in figuring out what might be going wrong.

1 Like

Hi @oleiade . Seems that the problem has been resolved. With version 0.45.0. We receive 202 status response.

Thanks for your help.

2 Likes