-
Notifications
You must be signed in to change notification settings - Fork 21
Description
The readme has a note about RestSharp >105.1.0 causing uploads to fail.
The PR in the linked issue was included in RestSharp 106.0.0.
One solution would be to upgrade the dependency on RestSharp to 106.0.0 to get the new overload of AddFile that includes ContentLength.
ClickSend targets net45 and RestSharp 106.0.0 requires at least net452, so ClickSend cannot be updated without increasing its target framework.
If it is not feasible to update the target framework of ClickSend, I have an idea to for a workaround, that should be compatible with both 105.1.0 and 106.0.0
Looking in the RestSharp code RestRequest.AddFile calls RestRequest.Files.Add and RestRequest.Files is public.
So in PrepareRequest it should be possible to replace
foreach (var param in fileParams)
{
request.AddFile(param.Value.Name, param.Value.Writer, param.Value.FileName, param.Value.ContentType);
}with
request.Files.AddRange(fileParams.Values);The workaround relies on the assumption that RestRequest.AddFile continues to just call RestRequest.Files.Add.