Facing issue with excel file upload in API load testing

Hello There :raised_hand:,
I am trying to Load test file upload functionality for my Application via APIs.
I noticed that the Content-type which is being sent as a payload is not showing the correct boundary values which is resulting in failure.
Here is my K6 Code and the response

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

const file = open('./test.xlsx','b');

export default function () {

const formData = new FormData();
formData.append("projectId", "ae5034a5-723d-4743-b5c8-0b03bbba1a43");

   let res11 = http.post(
     'https://web-url/v1/Excel/UploadExcelFile', formData.body(), {
      headers: {
        Authorization: 'Mytoken',
        'Content-Type': `multipart/form-data; boundary=${formData.boundary}`,
        //'Content-Type': `application/octet-stream`,
       //'Content-Type': formData.contentType,
   check(res11, { "status is 200": (r) => r.status === 200 });
   const jsonData11 = JSON.parse(res11.body);
   console.log("UploadExcelFile Status: "+res11.status+" "+res11.error);

This is what i see in my logs

Whereas, same request sent from Postman for this particular API, the content-type in the console looks like this

Content-Type: multipart/form-data; boundary=--------------------------207119253063992349634509

Can anyone please help me resolving this issue.
Thanks in advance. :man_dancing:

Hi @AJ86

Welcome to the community forums :wave:

Can you try with the multipart example in the k6 docs or the advanced multipart request?

If that does not work, can you share the new script; also execute with --http-debug and share the (sanitized) results? You can compare the exchange with what Postman is doing and that might give us additional hints.

I hope this helps.