postmanlabs / curl-to-postman

Converts curl requests to Postman Collection v2 request objects
Apache License 2.0
65 stars 31 forks source link

Support more input types in convert() function #35

Open raghavbhatia336 opened 3 years ago

raghavbhatia336 commented 3 years ago

I am working on a new command newman request that will enable newman’s users to send a single request and show the request/response using a reporter of their choice. Here is the PR and it is work in progress. Since newman request is the drop-in replacement of curl, it will support same options as curl command. I want to use curl-to-postman capabilities to create the Postman collection out of these curl options.

Currently, the convert() function only accepts string as the input type.

Since the options are already parsed in newman command, it is a bit of overhead to create a stringified curl command out of it.

I was discussing with GSoc mentors if we could add a functionality to the curl-to-postman library so that we can pass the already parsed curl options. One of the ways which I tried is by adding a new input type to convert() function. After this change, the convert() function is able to accept input in the following format:

{
  type: "curl-options",
  data: {
    request: "GET",
    url: "https://google.com",
    headers: [],
  }
}

The field names in data are the names of curl options in long notation. Before doing this change, I wanted to get some feedback from the curl-to-postman community about this idea. I want to make it more aesthetically pleasing and also architecturally neat. Looking forward to your suggestions and discussion regarding this.

nimit2801 commented 3 years ago

Hey, @raghavbhatia336 I'm working on the command in GSoC. You have a great idea hope we can explore it together.

raghavbhatia336 commented 3 years ago

@nimit2801 sure! Please check out my PR on this and we can contribute there.

raghavbhatia336 commented 3 years ago

CC: @coditva @umeshp7