curl-to-postman icon indicating copy to clipboard operation
curl-to-postman copied to clipboard

Support more input types in convert() function

Open raghavbhatia336 opened this issue 3 years ago • 3 comments

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.

raghavbhatia336 avatar Apr 10 '21 05:04 raghavbhatia336

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

nimit2801 avatar Apr 11 '21 22:04 nimit2801

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

raghavbhatia336 avatar Apr 12 '21 14:04 raghavbhatia336

CC: @coditva @umeshp7

raghavbhatia336 avatar Apr 13 '21 03:04 raghavbhatia336