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

Wrong cURL code generation when multipart #8736

Closed
nelson-gonzalez opened this issue Jul 3, 2020 · 1 comment · Fixed by postmanlabs/postman-code-generators#418
Closed
Assignees

Comments

@nelson-gonzalez
Copy link

nelson-gonzalez commented Jul 3, 2020

Describe the bug
When you make a multipart request with a file and another field of JSON type, the generated code snippet to run this request with cURL is wrong. Omits the type for the field with JSON type.

To Reproduce
Steps to reproduce the behavior:

  1. Create a request with body of type form-data
  2. Add a field of type file with content type multipart/form-data and a field of type text with content type application/json.
  3. Go to Code functionality and generate code for cURL.
  4. See the error. The generated code does not work, but postman request do.

Expected behavior
The generated code sniped should be:

curl --location --request POST 'https://example.com/documents' \
--form 'file=@/Users/xxxx/Downloads/0ffaa789-b1a7-4ce3-a80b-4c7f3fcfd5d2.png' \
--form 'metadata={"group": "PROOF_RESIDENCE","type": "UNDEFINED","side": "FRONT"};type=application/json'

Screenshots
Image for step 2:
image

Image for step 3:
image

App information:

  • App Type: Native App
  • Postman Version: 7.27.1
  • OS: macOS Catalina 10.15.5

Additional context
This problem exist in almost all libraries that generate content body for multipart/form-data.

@IlabSentuser
Copy link

Hello, unless I am confused about this changes I think the problem is not solved. cURL codegens keep ignoring content-type in order to generate the snippets.

Screenshot_20211215_164722

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