usebruno / bruno

Opensource IDE For Exploring and Testing Api's (lightweight alternative to postman/insomnia)
https://www.usebruno.com/
MIT License
27.34k stars 1.25k forks source link

Generate equivalent curl command for a given request #850

Closed mpettis closed 5 months ago

mpettis commented 1 year ago

I often use Postman to generate an equivalent curl command I can run on a headless server. Does bruno have that equivalent feature, and if not, this would be a desired feature.

n00o commented 1 year ago

The feature you are looking for @mpettis is Code Generation and it thankfully already exists but I don't think it is very well documented on the website yet and isn't too obvious. Here are the steps:

  1. On the left sidebar, hover over the desired request
  2. Click on the 3 horizontal dots that will appear
  3. Select Generate Code
  4. In the popup window, Select Shell-Curl

Currently there is no environment variable interpolation for the code generation but it is definitely something that could be added. The Code Generation feature could probably be put below the run arrow as a button kind of like Postman to help those more familiar with that platform.

mpettis commented 1 year ago

Yes, I see it now, Thanks! I thought that it would be implemented, as that direction seems easy. And yes, variable interpolation would be quite welcome. Appreciate the work on this!

On Wed, Nov 1, 2023 at 10:40 AM n00o @.***> wrote:

The feature you are looking for @mpettis https://github.com/mpettis is Code Generation and it thankfully already exists but I don't think it is very well documented on the website yet and isn't too obvious. Here are the steps:

  1. On the left sidebar, hover over the desired request
  2. Click on the 3 horizontal dots that will appear
  3. Select Generate Code
  4. In the popup window, Select Shell-Curl

Currently there is no environment variable interpolation for the code generation but it is definitely something that could be added. The Code Generation feature could probably be put below the run arrow as a button kind of like Postman to help those more familiar with that platform.

— Reply to this email directly, view it on GitHub https://github.com/usebruno/bruno/issues/850#issuecomment-1789182337, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA3QKIOI2JAZDQAUF2QA5X3YCJUOTAVCNFSM6AAAAAA6ZK7GPKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBZGE4DEMZTG4 . You are receiving this because you were mentioned.Message ID: @.***>

-- "Everything is the way it is because it got that way." -- D'Arcy Wentworth Thompson

ZeeCoder commented 9 months ago

wow I would've never found this. I was considering going back to Postman because of this. :zipper_mouth_face:

soo glad it's there :muscle:

I'd probably put it somewhere similar to Postman behind a code-block <> icon of sorts

ernstki commented 5 months ago

Currently there is no environment variable interpolation for the code generation but it is definitely something that could be added. The Code Generation feature could probably be put below the run arrow as a button kind of like Postman to help those more familiar with that platform.

I was surprised when I didn't see the authentication/authorization part embedded in curl request, so it's definitely in line with expectations to have the code generation add the necessary -H / --header options for the auth header(s).

I was about to suggest that @mpettis close the issue (since, nominally, code generation does this already). But maybe the issue needs to stay open until the auth bit is implemented, too?

mpettis commented 5 months ago

I didn't realize I left it open. I will close this unless there is some objection -- I think the --header option should probably be a separate ticket (as I didn't originally ask about this)? If @ernstki wants to open a separate ticket, that would probably be the best path forward.