Feature/prompt vars extended#6104
Conversation
aa803e2 to
ad02a3d
Compare
ad02a3d to
48a09f6
Compare
|
Hey there, Two short questions:
|
|
Also in path params, it seems like the proper setup is |
|
Hello, Would be awesome being able to use the prompt from the scripts. Setting a variable using Also running |
Hey @tsteckenborn, No further enhancements are planned at this time. We may add support for prompts via script in the future — for example: const username = bru.prompt("Enter your username");However, this is not currently a priority. Our documentation for prompt variables is now available here: https://docs.usebruno.com/variables/prompt-variables If you have any questions or need more information, feel free to reach out. |
Hey @VGNieto, Bruno currently does not support prompts via scripts, the runner, or the CLI. We may add support for prompts via script in the future — for example: const username = bru.prompt("Enter your username");However, this is not currently a priority. Please refer to our documentation for prompt variables: https://docs.usebruno.com/variables/prompt-variables If you have any questions or need more information, feel free to reach out. |
Description
Enhances the PR #5114 by @rbonestell
JIRA
Description from original PR #5114
I have experienced countless instances where it would be extremely convenient to create and share requests which prompt the user for specific values before sending the request. Some examples include prompting for a login and/or password for a login request to avoid saving and sensitive information, and prompting for identifiers for ad-hoc utility requests.
🎉 This PR introduces "prompt variables" to Bruno!
Users can define prompt variables (designed by
{{?:Prompt Here}}) anywhere in their request where variables are supported. Prompt variables are syntax highlighted in blue (CSSdodgerblueto be exact) alongside the green and red colors which Bruno already uses to highlight valid and invalid variables respectively.Request Setup Screenshots
When a request is submitted and the app detects one or more prompt variables (designed by
{{?:Prompt Here}}) it will present a modal to prompt the user for each value before proceeding. Prompt variables are deduplicated before prompting and all instances of the same prompt variable will be interpolated/substituted with the user-provided value. (If no value is provided, the prompt variable is simply removed from the request (effectively substituted by an empty string).Prompt Variables Modal
The app proceeds to include the user-provided values as ephemeral runtime variables for the current request and the existing runtime variable interpolation does the rest!
POST Echo Screenshot
💻 How does this work with bruno-cli?
Bruno CLI will skip any request containing prompt variables and mark their status as
skipped.Contribution Checklist:
Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.
Publishing to New Package Managers
Please see here for more information.