Skip to content

Commit

Permalink
fix: Removed default headers for Multipart form data.
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenDV committed Nov 2, 2024
1 parent 2084dd2 commit afa9b53
Show file tree
Hide file tree
Showing 67 changed files with 71 additions and 497 deletions.
8 changes: 1 addition & 7 deletions src/libs/AutoSDK/Sources/Sources.Methods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -389,13 +389,7 @@ public static string GenerateRequestData(
{
var add = x.Type.IsBinary ? @$"
__httpRequestContent.Add(
content: new global::System.Net.Http.ByteArrayContent(request.{x.Name} ?? global::System.Array.Empty<byte>())
{{
Headers =
{{
ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse(""{endPoint.RequestMediaType}""),
}},
}},
content: new global::System.Net.Http.ByteArrayContent(request.{x.Name} ?? global::System.Array.Empty<byte>()),
name: ""{x.Id}"",
fileName: request.{x.Name + "name"} ?? string.Empty);
" : @$"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,7 @@ partial void ProcessV1UploadDatasetResponseContent(
}
using var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();
__httpRequestContent.Add(
content: new global::System.Net.Http.ByteArrayContent(request.DatasetFile ?? global::System.Array.Empty<byte>())
{
Headers =
{
ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("multipart/form-data"),
},
},
content: new global::System.Net.Http.ByteArrayContent(request.DatasetFile ?? global::System.Array.Empty<byte>()),
name: "dataset_file",
fileName: request.DatasetFilename ?? string.Empty);
__httpRequestContent.Add(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,7 @@ partial void ProcessV1LibraryUploadResponseContent(
}
using var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();
__httpRequestContent.Add(
content: new global::System.Net.Http.ByteArrayContent(request.File ?? global::System.Array.Empty<byte>())
{
Headers =
{
ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("multipart/form-data"),
},
},
content: new global::System.Net.Http.ByteArrayContent(request.File ?? global::System.Array.Empty<byte>()),
name: "file",
fileName: request.Filename ?? string.Empty);
if (request.Path != default)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,7 @@ partial void ProcessV1UploadDatasetResponseContent(
}
using var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();
__httpRequestContent.Add(
content: new global::System.Net.Http.ByteArrayContent(request.DatasetFile ?? global::System.Array.Empty<byte>())
{
Headers =
{
ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("multipart/form-data"),
},
},
content: new global::System.Net.Http.ByteArrayContent(request.DatasetFile ?? global::System.Array.Empty<byte>()),
name: "dataset_file",
fileName: request.DatasetFilename ?? string.Empty);
__httpRequestContent.Add(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,7 @@ partial void ProcessV1LibraryUploadResponseContent(
}
using var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();
__httpRequestContent.Add(
content: new global::System.Net.Http.ByteArrayContent(request.File ?? global::System.Array.Empty<byte>())
{
Headers =
{
ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("multipart/form-data"),
},
},
content: new global::System.Net.Http.ByteArrayContent(request.File ?? global::System.Array.Empty<byte>()),
name: "file",
fileName: request.Filename ?? string.Empty);
if (request.Path != default)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,25 +189,13 @@ partial void ProcessCreateDatasetResponseContent(
name: "X-Client-Name");
}
__httpRequestContent.Add(
content: new global::System.Net.Http.ByteArrayContent(request.Data ?? global::System.Array.Empty<byte>())
{
Headers =
{
ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("multipart/form-data"),
},
},
content: new global::System.Net.Http.ByteArrayContent(request.Data ?? global::System.Array.Empty<byte>()),
name: "data",
fileName: request.Dataname ?? string.Empty);
if (request.EvalData != default)
{
__httpRequestContent.Add(
content: new global::System.Net.Http.ByteArrayContent(request.EvalData ?? global::System.Array.Empty<byte>())
{
Headers =
{
ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("multipart/form-data"),
},
},
content: new global::System.Net.Http.ByteArrayContent(request.EvalData ?? global::System.Array.Empty<byte>()),
name: "eval_data",
fileName: request.EvalDataname ?? string.Empty);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,25 +177,13 @@ partial void ProcessCreateDatasetResponseContent(
name: "X-Client-Name");
}
__httpRequestContent.Add(
content: new global::System.Net.Http.ByteArrayContent(request.Data ?? global::System.Array.Empty<byte>())
{
Headers =
{
ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("multipart/form-data"),
},
},
content: new global::System.Net.Http.ByteArrayContent(request.Data ?? global::System.Array.Empty<byte>()),
name: "data",
fileName: request.Dataname ?? string.Empty);
if (request.EvalData != default)
{
__httpRequestContent.Add(
content: new global::System.Net.Http.ByteArrayContent(request.EvalData ?? global::System.Array.Empty<byte>())
{
Headers =
{
ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("multipart/form-data"),
},
},
content: new global::System.Net.Http.ByteArrayContent(request.EvalData ?? global::System.Array.Empty<byte>()),
name: "eval_data",
fileName: request.EvalDataname ?? string.Empty);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,7 @@ partial void ProcessUploadCsvDatasetResponseContent(
}
using var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();
__httpRequestContent.Add(
content: new global::System.Net.Http.ByteArrayContent(request.File ?? global::System.Array.Empty<byte>())
{
Headers =
{
ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("multipart/form-data"),
},
},
content: new global::System.Net.Http.ByteArrayContent(request.File ?? global::System.Array.Empty<byte>()),
name: "file",
fileName: request.Filename ?? string.Empty);
__httpRequestContent.Add(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,7 @@ partial void ProcessUploadExamplesResponseContent(
content: new global::System.Net.Http.StringContent($"{datasetId}"),
name: "dataset_id");
__httpRequestContent.Add(
content: new global::System.Net.Http.ByteArrayContent(request.File ?? global::System.Array.Empty<byte>())
{
Headers =
{
ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("multipart/form-data"),
},
},
content: new global::System.Net.Http.ByteArrayContent(request.File ?? global::System.Array.Empty<byte>()),
name: "file",
fileName: request.Filename ?? string.Empty);
__httpRequestContent.Add(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,7 @@ partial void ProcessUploadCsvDatasetResponseContent(
}
using var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();
__httpRequestContent.Add(
content: new global::System.Net.Http.ByteArrayContent(request.File ?? global::System.Array.Empty<byte>())
{
Headers =
{
ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("multipart/form-data"),
},
},
content: new global::System.Net.Http.ByteArrayContent(request.File ?? global::System.Array.Empty<byte>()),
name: "file",
fileName: request.Filename ?? string.Empty);
__httpRequestContent.Add(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,7 @@ partial void ProcessUploadExamplesResponseContent(
content: new global::System.Net.Http.StringContent($"{datasetId}"),
name: "dataset_id");
__httpRequestContent.Add(
content: new global::System.Net.Http.ByteArrayContent(request.File ?? global::System.Array.Empty<byte>())
{
Headers =
{
ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("multipart/form-data"),
},
},
content: new global::System.Net.Http.ByteArrayContent(request.File ?? global::System.Array.Empty<byte>()),
name: "file",
fileName: request.Filename ?? string.Empty);
__httpRequestContent.Add(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,7 @@ partial void ProcessCreateGcpServiceAccountResponseContent(
name: "credential_id");
}
__httpRequestContent.Add(
content: new global::System.Net.Http.ByteArrayContent(request.ServiceAccountFile ?? global::System.Array.Empty<byte>())
{
Headers =
{
ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("multipart/form-data"),
},
},
content: new global::System.Net.Http.ByteArrayContent(request.ServiceAccountFile ?? global::System.Array.Empty<byte>()),
name: "service_account_file",
fileName: request.ServiceAccountFilename ?? string.Empty);
__httpRequest.Content = __httpRequestContent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,7 @@ partial void ProcessCreateResponseContent(
}
using var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();
__httpRequestContent.Add(
content: new global::System.Net.Http.ByteArrayContent(request.Pfile ?? global::System.Array.Empty<byte>())
{
Headers =
{
ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("multipart/form-data"),
},
},
content: new global::System.Net.Http.ByteArrayContent(request.Pfile ?? global::System.Array.Empty<byte>()),
name: "pfile",
fileName: request.Pfilename ?? string.Empty);
__httpRequest.Content = __httpRequestContent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,7 @@ partial void ProcessPatchImageResponseContent(
name: "pipeline_id_or_pointer");
}
__httpRequestContent.Add(
content: new global::System.Net.Http.ByteArrayContent(request.ImageFile ?? global::System.Array.Empty<byte>())
{
Headers =
{
ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("multipart/form-data"),
},
},
content: new global::System.Net.Http.ByteArrayContent(request.ImageFile ?? global::System.Array.Empty<byte>()),
name: "image_file",
fileName: request.ImageFilename ?? string.Empty);
__httpRequest.Content = __httpRequestContent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,7 @@ partial void ProcessCreateGcpServiceAccountResponseContent(
name: "credential_id");
}
__httpRequestContent.Add(
content: new global::System.Net.Http.ByteArrayContent(request.ServiceAccountFile ?? global::System.Array.Empty<byte>())
{
Headers =
{
ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("multipart/form-data"),
},
},
content: new global::System.Net.Http.ByteArrayContent(request.ServiceAccountFile ?? global::System.Array.Empty<byte>()),
name: "service_account_file",
fileName: request.ServiceAccountFilename ?? string.Empty);
__httpRequest.Content = __httpRequestContent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,7 @@ partial void ProcessCreateResponseContent(
}
using var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();
__httpRequestContent.Add(
content: new global::System.Net.Http.ByteArrayContent(request.Pfile ?? global::System.Array.Empty<byte>())
{
Headers =
{
ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("multipart/form-data"),
},
},
content: new global::System.Net.Http.ByteArrayContent(request.Pfile ?? global::System.Array.Empty<byte>()),
name: "pfile",
fileName: request.Pfilename ?? string.Empty);
__httpRequest.Content = __httpRequestContent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,7 @@ partial void ProcessPatchImageResponseContent(
name: "pipeline_id_or_pointer");
}
__httpRequestContent.Add(
content: new global::System.Net.Http.ByteArrayContent(request.ImageFile ?? global::System.Array.Empty<byte>())
{
Headers =
{
ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("multipart/form-data"),
},
},
content: new global::System.Net.Http.ByteArrayContent(request.ImageFile ?? global::System.Array.Empty<byte>()),
name: "image_file",
fileName: request.ImageFilename ?? string.Empty);
__httpRequest.Content = __httpRequestContent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,7 @@ partial void ProcessCreateTranscriptionResponseContent(
}
using var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();
__httpRequestContent.Add(
content: new global::System.Net.Http.ByteArrayContent(request.File ?? global::System.Array.Empty<byte>())
{
Headers =
{
ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("multipart/form-data"),
},
},
content: new global::System.Net.Http.ByteArrayContent(request.File ?? global::System.Array.Empty<byte>()),
name: "file",
fileName: request.Filename ?? string.Empty);
__httpRequestContent.Add(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,7 @@ partial void ProcessCreateTranslationResponseContent(
}
using var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();
__httpRequestContent.Add(
content: new global::System.Net.Http.ByteArrayContent(request.File ?? global::System.Array.Empty<byte>())
{
Headers =
{
ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("multipart/form-data"),
},
},
content: new global::System.Net.Http.ByteArrayContent(request.File ?? global::System.Array.Empty<byte>()),
name: "file",
fileName: request.Filename ?? string.Empty);
__httpRequestContent.Add(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,7 @@ partial void ProcessCreateFileResponseContent(
}
using var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();
__httpRequestContent.Add(
content: new global::System.Net.Http.ByteArrayContent(request.File ?? global::System.Array.Empty<byte>())
{
Headers =
{
ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("multipart/form-data"),
},
},
content: new global::System.Net.Http.ByteArrayContent(request.File ?? global::System.Array.Empty<byte>()),
name: "file",
fileName: request.Filename ?? string.Empty);
__httpRequestContent.Add(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,7 @@ partial void ProcessCreateImageEditResponseContent(
}
using var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();
__httpRequestContent.Add(
content: new global::System.Net.Http.ByteArrayContent(request.Image ?? global::System.Array.Empty<byte>())
{
Headers =
{
ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("multipart/form-data"),
},
},
content: new global::System.Net.Http.ByteArrayContent(request.Image ?? global::System.Array.Empty<byte>()),
name: "image",
fileName: request.Imagename ?? string.Empty);
__httpRequestContent.Add(
Expand All @@ -80,13 +74,7 @@ partial void ProcessCreateImageEditResponseContent(
if (request.Mask != default)
{
__httpRequestContent.Add(
content: new global::System.Net.Http.ByteArrayContent(request.Mask ?? global::System.Array.Empty<byte>())
{
Headers =
{
ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("multipart/form-data"),
},
},
content: new global::System.Net.Http.ByteArrayContent(request.Mask ?? global::System.Array.Empty<byte>()),
name: "mask",
fileName: request.Maskname ?? string.Empty);
}
Expand Down
Loading

0 comments on commit afa9b53

Please sign in to comment.