@@ -60,7 +60,7 @@ namespace {{ spec.title | caseUcfirst }}
6060 {
6161 _endpoint = endpoint;
6262 _http = http ?? new HttpClient();
63-
63+
6464 _httpForRedirect = httpForRedirect ?? new HttpClient(
6565 new HttpClientHandler(){
6666 AllowAutoRedirect = false
@@ -220,7 +220,7 @@ namespace {{ spec.title | caseUcfirst }}
220220
221221 public async Task<String > Redirect(
222222 string method,
223- string path,
223+ string path,
224224 Dictionary<string , string > headers,
225225 Dictionary<string , object ?> parameters)
226226 {
@@ -269,7 +269,7 @@ namespace {{ spec.title | caseUcfirst }}
269269 var response = await _http.SendAsync(request);
270270 var code = (int)response.StatusCode;
271271
272- if (response.Headers.TryGetValues("x-{{ spec .title | lower }}-warning", out var warnings))
272+ if (response.Headers.TryGetValues("x-{{ spec .title | lower }}-warning", out var warnings))
273273 {
274274 foreach (var warning in warnings)
275275 {
@@ -376,16 +376,23 @@ namespace {{ spec.title | caseUcfirst }}
376376
377377 if (!string.IsNullOrEmpty(idParamName) && (string)parameters[idParamName] != "unique()")
378378 {
379+ try
380+ {
379381 // Make a request to check if a file already exists
380382 var current = await Call<Dictionary <string , object ?>>(
381383 method: "GET",
382- path: "$ path/${params [idParamName]}",
383- headers ,
384- parameters = new Dictionary<string , object ?>()
384+ path: $"{ path}/{parameters [idParamName]}",
385+ new Dictionary< string , string > { { "content-type", "application/json" } } ,
386+ parameters: new Dictionary<string , object ?>()
385387 );
386388 var chunksUploaded = (long)current["chunksUploaded"];
387389 offset = chunksUploaded * ChunkSize;
388390 }
391+ catch (Exception ex)
392+ {
393+ // ignored as it mostly means file not found
394+ }
395+ }
389396
390397 while (offset < size)
391398 {
0 commit comments