mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-24 21:25:45 +00:00
fix: include request URL in prompt variable extraction and add tests (#6412)
This commit is contained in:
@@ -478,6 +478,7 @@ const extractPromptVariablesForRequest = async (item, collection) => {
|
||||
prompts.push(...extractPromptVariables(headers));
|
||||
prompts.push(...extractPromptVariables(request.params));
|
||||
prompts.push(...extractPromptVariables(resolvedAuthRequest.auth));
|
||||
prompts.push(...extractPromptVariables(request.url));
|
||||
|
||||
// Remove duplicates
|
||||
const uniquePrompts = Array.from(new Set(prompts));
|
||||
|
||||
@@ -5,7 +5,7 @@ meta {
|
||||
}
|
||||
|
||||
post {
|
||||
url: http://localhost:8081/api/echo/json?query={{?Enter Query Variable}}
|
||||
url: http://localhost:{{?Enter Port Variable}}/api/echo/json?query={{?Enter Query Variable}}
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ test.describe('Prompt Variables Interpolation', () => {
|
||||
await test.step('Verify duplicate prompt variables are not allowed', async () => {
|
||||
// Enter the prompt variables
|
||||
promptInputs = promptVariablesModal.getByTestId('prompt-variable-input-container');
|
||||
await expect(promptInputs).toHaveCount(11);
|
||||
await expect(promptInputs).toHaveCount(12);
|
||||
});
|
||||
|
||||
await test.step('Verify disabled / non selected modes prompt variables are not prompted', async () => {
|
||||
@@ -46,6 +46,7 @@ test.describe('Prompt Variables Interpolation', () => {
|
||||
});
|
||||
|
||||
await test.step('Fill the prompt variables and send the request', async () => {
|
||||
await promptInputs.filter({ hasText: 'Enter Port Variable' }).locator('input').fill('8081');
|
||||
await promptInputs.filter({ hasText: 'Enter Query Variable' }).locator('input').fill('queryPromptValue');
|
||||
await promptInputs.filter({ hasText: 'Enter Body Variable' }).locator('input').fill('bodyPromptValue');
|
||||
await promptInputs.filter({ hasText: 'Enter Number Variable' }).locator('input').fill('123');
|
||||
|
||||
Reference in New Issue
Block a user