[BUG] [csharp] UserAgent not updated in CallApiAsync
Created by: jamesrusso
In ApiClient.cs, The UserAgent is not updated in the CallApiAync method, but it in the CallApi method.
public Object CallApi(
String path, RestSharp.Method method, List<KeyValuePair<String, String>> queryParams, Object postBody,
Dictionary<String, String> headerParams, Dictionary<String, String> formParams,
Dictionary<String, FileParameter> fileParams, Dictionary<String, String> pathParams,
String contentType)
{
var request = PrepareRequest(
path, method, queryParams, postBody, headerParams, formParams, fileParams,
pathParams, contentType);
// set timeout
RestClient.Timeout = Configuration.Timeout;
// set user agent
RestClient.UserAgent = Configuration.UserAgent;
InterceptRequest(request);
var response = RestClient.Execute(request);
InterceptResponse(request, response);
return (Object) response;
}
vs
public async System.Threading.Tasks.Task<Object> CallApiAsync(
String path, RestSharp.Method method, List<KeyValuePair<String, String>> queryParams, Object postBody,
Dictionary<String, String> headerParams, Dictionary<String, String> formParams,
Dictionary<String, FileParameter> fileParams, Dictionary<String, String> pathParams,
String contentType)
{
var request = PrepareRequest(
path, method, queryParams, postBody, headerParams, formParams, fileParams,
pathParams, contentType);
InterceptRequest(request);
var response = await RestClient.ExecuteTaskAsync(request);
InterceptResponse(request, response);
return (Object)response;
}
I can submit the pull request to fix this template, but wanted some discussion if this should be fixed/set on each request or globally when the RestClient is created. I haven't dug into it this much.