Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sending files using a multipart/form-data request fails (since 1.37.0) #3723

Open
2 tasks done
bbak opened this issue Jan 3, 2025 · 7 comments
Open
2 tasks done

Sending files using a multipart/form-data request fails (since 1.37.0) #3723

bbak opened this issue Jan 3, 2025 · 7 comments
Assignees
Labels
bug Something isn't working module-file-body

Comments

@bbak
Copy link

bbak commented Jan 3, 2025

I have checked the following:

  • I use the newest version of bruno.
  • I've searched existing issues and found nothing related to my issue.

Describe the bug

I've a collection that uploads some Json files to some service, which was working flawlessly with 1.36.x but doesn't in 1.37.0.

Bruno's error message is this:
Error invoking remote method 'send-http-request': TypeError: data should be a string, Buffer or Uint8Array

Adding a content-type ( @contentType(application/json) ) does not change the behavior.

.bru file to reproduce the bug

meta {
name: Some Name
type: http
seq: 1
}

post {
url: https://some.target.url/api/receive
body: multipartForm
auth: inherit
}

headers {
Content-Type: multipart/form-data
}

body:multipart-form {
id: 65e62dabcd3c585015b9f56f
data: @file(C:\Temp\bruno_upload\some_file.json)
}

Screenshots/Live demo link

dot_black
@bbak bbak added the bug Something isn't working label Jan 3, 2025
@mesopotamiaMD
Copy link

I'm a user and have just seen your case, as I have had a similar issue. In my case, it worked when i used relative path

sourceFile: @file(../../Jobsfolder/test.txt)

but you have to change it over the file mode.

The relative path is added to the installation path, which makes no sense and needs to be fixed. Regards...

@bbak
Copy link
Author

bbak commented Jan 4, 2025

Ah, interesting. Thanks.

Yet I believe, when using the UI to select a file, the absolute Path is written to the .bru file. Hence it needs to be fixed anyways.

@ganesh-bruno
Copy link
Collaborator

Hey @bbak

Thanks for reporting this issue.

I tried to reproduce it with version 1.37.0, adding the json file to the body/multipart and setting the Content-Type: multipart/form-data` header, as you mentioned. It seems to be working fine on my end.

Could you try removing the auth and header settings, and then check again to see if it works for you?

If the issue still persists after removing those, would it be possible for you to share a video or screenshot of the issue? This will help us understand if we're on the same page or if I missed something while reproducing it.

3723.mov

@bbak
Copy link
Author

bbak commented Jan 7, 2025

Hey, I already see a difference: I run Bruno in Developer Mode, since I need access to the filesystem. And I actually wonder how you can add a file from the filesystem while being in Safe (Sandbox) Mode. Anyway, here's a Video:

Bruno.2025-01-07.mp4

@bbak
Copy link
Author

bbak commented Jan 7, 2025

Still present in 1.38.0

Changing to Safe Mode yields the same behaviour.

@bbak bbak changed the title Sending files using a multipart/form-data request fails with 1.37.0 Sending files using a multipart/form-data request fails (since 1.37.0) Jan 7, 2025
@bill-wirz-iw
Copy link

I have also seen this behaviour. I was able to send a file using the Content-Type: multipart/data header (what @ganesh-bruno used). However, the data was not formatted with the correct boundaries and was rejected by the API. However, Content-Type: multipart/form-data does not work (same error as @bbak)

@flleonx
Copy link

flleonx commented Jan 8, 2025

I'm experiencing the same problems as @bbak and @bill-wirz-iw in version 1.38.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working module-file-body
Projects
None yet
Development

No branches or pull requests

5 participants