Closed
Description
Description
Using a FormData request, in the method PrepareRequest of the ApiClient, when file is added to the request, RestSharp doesn't set the Content-Length.
foreach (var param in fileParams)
{
request.AddFile(param.Value.Name,` param.Value.Writer, param.Value.FileName, param.Value.ContentType);
}
Swagger-codegen version
Version 2.10.2
Suggest a Fix
At the time, the workaround i found was to modify the generated code and set the content length explicitly:
var index = 0;
foreach (var param in fileParams)
{
request.AddFile(param.Value.Name, param.Value.Writer, param.Value.FileName, param.Value.ContentType);
request.Files[index++].ContentLength = param.Value.ContentLength;
}