bruno icon indicating copy to clipboard operation
bruno copied to clipboard

[CLI] Multipart form body not sent — body mode multipart-form never matches multipartForm in prepare-request.js

Open halfpastfive opened this issue 8 months ago • 4 comments

I have checked the following:

  • [x] I have searched existing issues and found nothing related to my issue.

This bug is:

  • [x] making Bruno unusable for me
  • [ ] slowing me down but I'm able to continue working
  • [ ] annoying
  • [ ] this feature was working in a previous version but is broken in the current release.

Bruno version

CLI 3.2.0

Operating System

macOS 26.3.1 (a) (25D771280a)

Describe the bug

When running a .bru file with body: multipart-form via the CLI runner (bru run), the request is sent without a Content-Type: multipart/form-data header and without a body. The server receives an empty POST request, causing a parse failure.

To Reproduce

  1. Create a request file: meta { name: Upload file type: http seq: 1 }

post { url: https://httpbin.org/post body: multipart-form auth: none }

body:multipart-form { file: @file(tests/fixtures/test-image.png) }

  1. Run: bru run --env request.bru
  2. Observe that the server receives no multipart body and no Content-Type: multipart/form-data header.

Expected behavior

The request is sent as multipart/form-data with the file attached, matching the behavior of the Bruno GUI.

**

bruno-formdata-repro.zip

**

There is a case mismatch between what the .bru v2 parser produces and what prepare-request.js expects.

@usebruno/filestore parses body: multipart-form and sets: request.body.mode = "multipart-form" // kebab-case

But src/runner/prepare-request.js checks: if (request.body.mode === 'multipartForm') { // camelCase — never matches axiosRequest.headers['content-type'] = 'multipart/form-data'; axiosRequest.data = enabledParams; }

Because no branch matches, neither the Content-Type header nor axiosRequest.data are set. The downstream check in run-single-request.js that builds the actual FormData object is also skipped (it gates on contentType.startsWith('multipart/')).

The same mismatch exists for form-urlencoded vs formUrlEncoded, though it may go unnoticed depending on use cases.

.bru file to reproduce the bug

No response

Screenshots/Live demo link

see attached request for a reproduction (cli)

halfpastfive avatar Mar 23 '26 14:03 halfpastfive

@halfpastfive I had the same problem; you need to enable developer mode. It worked for me

Image

dakheuch avatar Apr 01 '26 16:04 dakheuch

We are currently investigating this.

helloanoop avatar Jun 25 '26 06:06 helloanoop

Hi @halfpastfive,

Thank you for taking the time to investigate and report this issue.

We haven't been able to reproduce it with our existing collections. To verify, we created a new collection, configured a request using Multipart Form, and tested it successfully. We also exported and re-imported the collection and tested it again, and the request continued to work as expected.

One thing I noticed is that when a request is created with Multipart Form, Bruno stores the body mode as multipartForm throughout the application, not multipart-form.

However, in the request attached to this issue, the body mode is set to multipart-form, which is not a valid value. Because of that, the request fails when executed. Ideally, it should look like this:

post {
  url: https://httpbin.org/post
  body: multipartForm
  auth: none
}

I'm curious about how the request ended up with multipart-form.

Could you let us know:

  • Which Bruno version are you using?
  • Was multipartForm changed to multipart-form manually, or was it generated automatically by Bruno?

This information would help us better understand and reproduce the issue on our side.

Thanks!

sharan-bruno avatar Jun 25 '26 10:06 sharan-bruno

Hi @halfpastfive, closing this issue since we are not able to reproduce it on our side and we haven't got any response in a while. If you are still facing this issue , please reopen it. Thank you!

sreelakshmi-bruno avatar Jul 10 '26 09:07 sreelakshmi-bruno