[BUG][DART-DIO] break in for loop in 'ApiKeyAuthInterceptor'
Created by: vancegillies
Hi,
Sorry for not following the bug report template but the issue is so simple and can probably be answered without having to have a repro.
There is a break statement in '/modules/openapi-generator/src/main/resources/dart-dio/auth/api_key_auth.mustache'
for (var info in authInfo) {
final authName = info["name"];
final authKeyName = info["keyName"];
final authWhere = info["where"];
final apiKey = apiKeys[authName];
if (apiKey != null) {
if (authWhere == 'query') {
options.queryParameters[authKeyName] = apiKey;
} else {
options.headers[authKeyName] = apiKey;
}
break; // <- THIS
}
}
A break in a for loop stops lopping, so if there is more then one apiKey only the first is added to the headers
I think 'continue' was intended? but also unneeded as its at the end of the loop anyway.
These are the headers i'm using
securitySchemes:
device_id:
type: apiKey
in: header
name: X-DEVICE-ID
app_id:
type: apiKey
in: header
name: X-APP-ID
session_token:
type: apiKey
in: header
name: Authorization
Only the app-id was being added to the headers, but removing the break statement fixed my issue.
Unless I'm missing something this seems like a bug
Again sorry not using a the template.
Thanks