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

Generating curl snippet for file in multi-part: missing @ #2224

Open
2 tasks done
fskexp opened this issue May 2, 2024 · 3 comments · May be fixed by #2231
Open
2 tasks done

Generating curl snippet for file in multi-part: missing @ #2224

fskexp opened this issue May 2, 2024 · 3 comments · May be fixed by #2231
Labels
bug Something isn't working

Comments

@fskexp
Copy link

fskexp commented May 2, 2024

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

  • Create a new POST request. Set the Body as a "Multipart Form"
  • Add a new File parameter
  • In the left panel, open the menu on the 3 dots and click Generate Code
  • Select Shell-Curl
  • Observe that the command includes a parameter such as --form file-param=/tmp/data.txt. Instead, it should be --form file-param=@/tmp/data.txt so curl uses the content of the designated file.

.bru file to reproduce the bug

meta {
  name: post-with-file
  type: http
  seq: 2
}

post {
  url: https://server.com/
  body: multipartForm
  auth: none
}

body:multipart-form {
  file-param: @file(/private/tmp/data.txt)
}

Screenshots/Live demo link

Without the @ (current behaviour), the request (as intercepted by a proxy) will contain the path of the file

--------------------------PkQw3TWuFyPky39PXxv28K
Content-Disposition: form-data; name="file-param"

/tmp/data.txt
--------------------------PkQw3TWuFyPky39PXxv28K--

If a @ is manually added, then the content of the file is sent:

--------------------------yHQvrEAijwpPonqPCwZZ8H
Content-Disposition: form-data; name="file-param"; filename="data.txt"
Content-Type: text/plain

coucou

--------------------------yHQvrEAijwpPonqPCwZZ8H--
@fskexp fskexp added the bug Something isn't working label May 2, 2024
leoferreiralima pushed a commit to leoferreiralima/bruno that referenced this issue May 3, 2024
@leoferreiralima leoferreiralima linked a pull request May 3, 2024 that will close this issue
5 tasks
leoferreiralima pushed a commit to leoferreiralima/bruno that referenced this issue May 3, 2024
@leoferreiralima
Copy link

@fskexp i have submited a solution on a PR to this, if you can review maybe can be merged soon

leoferreiralima added a commit to leoferreiralima/bruno that referenced this issue May 3, 2024
@Fabiensk
Copy link

Fabiensk commented May 6, 2024

Hi, it looks good for me. I verified that in the httpsnippets library the @ is added if the parameter is ‘fileName‘

@leoferreiralima
Copy link

@Fabiensk exactly, I have added this rule on my PR, can you review please?

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

Successfully merging a pull request may close this issue.

3 participants