Skip to content

Can't import curls generated from Code->cUrl (New Code Generation Mode) #8292

Description

@softbucket

The Code->cURL generator and Postman import is useful for us to share post-body requests around without having to save it to a collection. The cURL generation is either not imported correctly (with new Code Generation) or is imported but not separated into key/value pairs under x-www-form-urlencoded.

For our workflow, saving a collection is an issue because it inundates our space with just "example" requests and even more severe is that it can be accidentally and unexpectedly mutated (more sensitive if after sharing).

To Reproduce
Steps to reproduce the behavior:

  1. Use "New Code Generation Mode"
  2. Import this request:
    curl --location --request POST 'https://httpbin.org/post'
    --header 'accept: application/json'
    --header 'Content-Type: application/x-www-form-urlencoded'
    -d 'test=test'
  3. Click on 'Code'
  4. Scroll down to 'cURL' and copy the content
  5. Import the recently copied content
  6. Body is empty (it is likely because postman import doesn't recognize --data-urlencode)

Note: If New Code Generation Mode is on, then the body does get populated but is not interpreted into the individual key/value pairs in body under x-www-form-urlencoded

Expected behavior
Post man should be able to import its exported cURL requests. Or the legacy behaviour should be imported with the original key/value pairs.

Screenshots
image
image
image
image

App information (please complete the following information):

  • Postman Version 7.21.1
  • OS: Catalina 10.15.4

Additional context
Ultimately, we are looking for an easy copy+paste solution for http-request sharing so that we can share without the need of saving and naming collections.

Previously we were able to flawless do this with the legacy code generation method because it would split each variable as a separate -d. Now it just congeals it all together under one -d and we have to manually perform an awkward search and replace to separate it again.

The new code generation probably would work very well if the import mechanic supported --data-urlencode

It is further awkward that the Postman cURL generation can't generate a request that can be perfectly imported by Postman.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions