applyToParams method
Future<void>
applyToParams(
- List<
QueryParam> queryParams, - Map<
String, String> headerParams
override
Apply authentication settings to header and query params.
Implementation
@override
Future<void> applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams,) async {
final paramValue = apiKeyPrefix.isEmpty ? apiKey : '$apiKeyPrefix $apiKey';
if (paramValue.isNotEmpty) {
if (location == 'query') {
queryParams.add(QueryParam(paramName, paramValue));
} else if (location == 'header') {
headerParams[paramName] = paramValue;
} else if (location == 'cookie') {
headerParams.update(
'Cookie',
(existingCookie) => '$existingCookie; $paramName=$paramValue',
ifAbsent: () => '$paramName=$paramValue',
);
}
}
}