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

Fix Curl Code Generator for Multipart Form File #2231

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

leoferreiralima
Copy link

@leoferreiralima leoferreiralima commented May 3, 2024

fixes #2224

Description

This PR fixes the issue #2224.

To resolve this issue i searched in httpsnippet code to understant how the lib expectes the file. Like the image below we should map a fileName property instead of value for files

image

Before:

image

After:

image

Contribution Checklist:

  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

Copy link

@Fabiensk Fabiensk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disclaimer: my knowledge and experience in NodeJS/Electron is limited.

Review: This change passes more contextual information to buildHarRequest and createPostData so when the target of the code generation is curl then the body file parameters value are passed with a fileName attribute to the HTTPSnippet library. In this library, we can that for the curl generation that a @ sign is added for file parameters of form requests.

This change could be also useful for other language targets such as python request, but it would require to be tested for each of them.
Possible improvement: leave a comment to mention that, for example before the line with client === 'curl':
// setting fileName could be also be beneficial for targets other than shell/curl, but would need to be tested

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generating curl snippet for file in multi-part: missing @
2 participants