-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Fix: all API keys are correctly added when importing OpenAPI collection #2302
base: main
Are you sure you want to change the base?
Fix: all API keys are correctly added when importing OpenAPI collection #2302
Conversation
brunoRequestItem.request.headers.push({ | ||
uid: uuid(), | ||
name: param.name, | ||
value: '{{apiKey}}', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello,
With this line you generate a duplicated variable name, so you need to rework your collection after import.
Maybe a param.name in camelCase can do it?
value = '{{' +
param.name
.replace('x-', '')
.replaceAll('-', ' ')
.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function(match, index) {
if (+match === 0) return ""; // or if (/\s+/.test(match)) for white spaces
return index === 0 ? match.toLowerCase() : match.toUpperCase();
})
+ '}}';
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey , could you please explain how this code generate a duplicated variable name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I apologize it's a mistake, I make confusion on ".name"
"securitySchemes": {
"apiKey1": {
"type": "apiKey",
"name": "x-api-key-1",
"in": "header"
},
"apiKey2": {
"type": "apiKey",
"name": "x-api-key-2",
"in": "header"
}
}
I thought you use this "name" (with x-api-key-1 / 2) but not.
I checkout your branch and that work fine! I waiting for this merge, I need this fix to :)
Thanks
@TheBlackReverand @Nithishvb any news on this PR? Has it been approved? |
Description
Fixes: #2254
This PR addresses the issue where only one API key was being added to the collection when importing OpenAPI collection that contain multiple keys. The fix ensures that all API keys are correctly included during the import process.
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.