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

Convert curl commands to request. #338

Closed
2 of 3 tasks
sanskar-mk2 opened this issue Oct 4, 2023 · 19 comments · Fixed by #840
Closed
2 of 3 tasks

Convert curl commands to request. #338

sanskar-mk2 opened this issue Oct 4, 2023 · 19 comments · Fixed by #840
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Community contribution is welcome

Comments

@sanskar-mk2
Copy link

sanskar-mk2 commented Oct 4, 2023

In Insomnia, whenever you post a curl request to the url bar, it autofills the headers/url/parameters/creds accordingly to that curl request. It is very important feature since curl is very universal to http requests. You can copy curl directly from browser.

  • Import Curl when creating a new request
  • Switch to curl mode automtically when a curl command is pasted in NewRequest modal
  • Allow importing of curl when a curl command is pasted in an already opened tab
@cvmocanu
Copy link

cvmocanu commented Oct 6, 2023

+1

In addition, an "Import from curl" option on the directory menu (next to "New request") should be added, to make it obvious that Bruno has this feature.

@helloanoop helloanoop added enhancement New feature or request good first issue Good for newcomers help wanted Community contribution is welcome labels Oct 6, 2023
@davidsr2r
Copy link

If you can't export to curl, that would also be great to have added. Apologies if it's already a feature, I couldn't see any obvious place in the docs that point that out & GOOG simply pointed me here.

@snippetkid
Copy link
Contributor

@sanskar-mk2 @helloanoop @cvmocanu I'll start working on this issue.

@snippetkid
Copy link
Contributor

A quick update, I'm through with the changes for this and is currently working on a bug while updating headers from the curl command.

@helloanoop
Copy link
Contributor

Would love to see a teaser video :)

@snippetkid
Copy link
Contributor

New.request.from.cURL.mp4

@helloanoop Here is what it looks like now. Please pass on review comments.

@helloanoop
Copy link
Contributor

Curl Import functionality is now available in 1.1.0 🎉

@girishkumar9
Copy link

@helloanoop it would be good to also have a curl script generated on an existing request. Postman has this feature and it is very handy to show the output of an API call

@cvmocanu
Copy link

@girishkumar9 that is already implemented: hover your mouse cursor over a request in the left-side tree, click the 3 dots, Generate Code, Shell-Curl.

@tbkahuna48
Copy link

On Apple M1 Pro with Ventura 13.5.2- All attempts to use the create new request with curl error out. Window with error disappears to quickly to copy the error.

@koljatm-edeka
Copy link

koljatm-edeka commented Jan 27, 2024

@girishkumar9 that is already implemented: hover your mouse cursor over a request in the left-side tree, click the 3 dots, Generate Code, Shell-Curl.

Unfortunately it doesn't work properly with variables. I have the base url in an environment variable and the export doesn't recognize the url.

Edit: the problem seems to be that I used "." in the variable names

@hp77-creator
Copy link

@helloanoop I was trying to import a curl but the request url is not properly appearing in the URL field, I tried multiple times, different URLs are coming. is there any debugger or someway that I can see what might be causing it? I tried importing from the collection tab(sidebar) and also in the request window(by clicking on '+').

@Aeolun
Copy link

Aeolun commented Mar 18, 2024

I kind of need to re-import from curl on an existing request. Making a new request for every time I want to import curl is really unwieldy.

@verhovsky
Copy link

Your Bash parser doesn't handle ANSI-C quoted strings, which browsers output when generating curl when some part of the request (namely the body) contains a control character, a non ASCII character or a single quote.

https://github.com/ChromeDevTools/devtools-frontend/blob/c9afdb4745a76866f7486be0e5cdd4e2b270d8af/front_end/panels/network/NetworkLogView.ts#L2090-L2099

You can use https://www.npmjs.com/package/shlex which does

@mivanov
Copy link

mivanov commented Mar 26, 2024

Just found Bruno. Really like it but I wish import from cURL was a little easier for when I need to do it repeatedly. A keyboard shortcut would go a long way. Or a magic textbox that recognizes when the pasted string starts with "curl " and does the right thing. To make this really seamless would be nice if the request name was optional or auto-generated. Thanks for creating this tool!

@jwetzell
Copy link
Contributor

jwetzell commented Apr 6, 2024

It would be nice if it wasn't so many clicks in. In Insomnia pasting a curl command into the url bar would prompt you to import it as a new request. It also had import from curl as an option from under the add menu directly.

@skoruppa
Copy link

skoruppa commented May 8, 2024

Yeah. When working as QA I need to import a lot of curl requests during the day, just to make some minor adjustments and run them. I don't want to create and save a new request in my collection each time I just want to import something from my browser.

Like stated before, both Insomnia and postman "overwrite" the current request when you paste a curl script right into the URL bar. Would love to have the same functionality in Bruno

@helloanoop
Copy link
Contributor

Closing this issue since the core functionality for importing Curl has been implemented. Additionally, the Curl importer has seen several updates over the past few months.

If you have suggestions for improvements, please feel free to raise a new issue with specific details.

@emirozmen07
Copy link

I think there is a problem, for example I put the curl below
curl --request POST 'localhost:8181/api/generateFile?uid=67176bc0b34ba4009e2a7032'
But, it did not add the request type (POST) and after I changed it to POST still gave error on request(415) while curl was working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Community contribution is welcome
Projects
None yet
Development

Successfully merging a pull request may close this issue.