mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-04 06:30:52 +00:00
This commit is contained in:
parent
119370079a
commit
60b29e1f8e
@ -279,7 +279,7 @@ namespace {{packageName}}.Client
|
|||||||
foreach (var fileParam in options.FileParameters)
|
foreach (var fileParam in options.FileParameters)
|
||||||
{
|
{
|
||||||
var content = new StreamContent(fileParam.Value.Content);
|
var content = new StreamContent(fileParam.Value.Content);
|
||||||
content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
|
content.Headers.ContentType = new MediaTypeHeaderValue(fileParam.Value.ContentType);
|
||||||
multipartContent.Add(content, fileParam.Key,
|
multipartContent.Add(content, fileParam.Key,
|
||||||
fileParam.Value.Name);
|
fileParam.Value.Name);
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,11 @@ namespace {{packageName}}.Client
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string Name { get; set; } = "no_name_provided";
|
public string Name { get; set; } = "no_name_provided";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The content type of the file
|
||||||
|
/// </summary>
|
||||||
|
public string ContentType { get; set; } = "application/octet-stream";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The content of the file
|
/// The content of the file
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -44,6 +49,19 @@ namespace {{packageName}}.Client
|
|||||||
Content = content;
|
Content = content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Construct a FileParameter from name and content
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filename">The filename</param>
|
||||||
|
/// <param name="contentType">The content type of the file</param>
|
||||||
|
/// <param name="content">The file content</param>
|
||||||
|
public FileParameter(string filename, string contentType, Stream content)
|
||||||
|
{
|
||||||
|
Name = filename;
|
||||||
|
ContentType = contentType;
|
||||||
|
Content = content;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Implicit conversion of stream to file parameter. Useful for backwards compatibility.
|
/// Implicit conversion of stream to file parameter. Useful for backwards compatibility.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -278,7 +278,7 @@ namespace Org.OpenAPITools.Client
|
|||||||
foreach (var fileParam in options.FileParameters)
|
foreach (var fileParam in options.FileParameters)
|
||||||
{
|
{
|
||||||
var content = new StreamContent(fileParam.Value.Content);
|
var content = new StreamContent(fileParam.Value.Content);
|
||||||
content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
|
content.Headers.ContentType = new MediaTypeHeaderValue(fileParam.Value.ContentType);
|
||||||
multipartContent.Add(content, fileParam.Key,
|
multipartContent.Add(content, fileParam.Key,
|
||||||
fileParam.Value.Name);
|
fileParam.Value.Name);
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,11 @@ namespace Org.OpenAPITools.Client
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string Name { get; set; } = "no_name_provided";
|
public string Name { get; set; } = "no_name_provided";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The content type of the file
|
||||||
|
/// </summary>
|
||||||
|
public string ContentType { get; set; } = "application/octet-stream";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The content of the file
|
/// The content of the file
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -52,6 +57,19 @@ namespace Org.OpenAPITools.Client
|
|||||||
Content = content;
|
Content = content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Construct a FileParameter from name and content
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filename">The filename</param>
|
||||||
|
/// <param name="contentType">The content type of the file</param>
|
||||||
|
/// <param name="content">The file content</param>
|
||||||
|
public FileParameter(string filename, string contentType, Stream content)
|
||||||
|
{
|
||||||
|
Name = filename;
|
||||||
|
ContentType = contentType;
|
||||||
|
Content = content;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Implicit conversion of stream to file parameter. Useful for backwards compatibility.
|
/// Implicit conversion of stream to file parameter. Useful for backwards compatibility.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user