API Key Auth not correctly being assigned to header
dmetinubu opened this issue · 0 comments
dmetinubu commented
We have the following logic in lib\auth\apikey.js
const aid = require('../aid');
class ApiKeyAuth {
constructor(settings) {
const params = settings.parameters();
const key = params.get('key');
const value = aid.evalString(params.get('value'));
if (params.get('in') === 'header') {
this.logic = '' + `config.headers['${key}'] = ${value};`;
} else {
this.logic = '' + `config.options['${key}'] = ${value};`;
}
}
}
module.exports = ApiKeyAuth;
I have my Postman collection auth defined like this:
A snippet from the json output from my exported collection:
"auth": {
"type": "apikey",
"apikey": [
{
"key": "value",
"value": "{{Authorization}}",
"type": "string"
},
{
"key": "key",
"value": "Authorization",
"type": "string"
}
]
},
It appears to be incorrectly using config.options instead of config.headers so my auth to fail when using the generated k6s output. If I manually change that part the auth works.
Perhaps something has changed in the output from Postman that's causing the line if (params.get('in') === 'header') {
to not work as expected?
Here is my Postman version: