mirror of
https://github.com/KevinWG/OSS.Tools.git
synced 2026-10-27 04:19:44 +08:00
调整上传文件时的ContentType赋值顺序问题
This commit is contained in:
+5
-3
@@ -94,12 +94,13 @@ namespace OSS.Http
|
||||
{
|
||||
string boundary = GetBoundary();
|
||||
var content= new MultipartFormDataContent(boundary);
|
||||
content.Headers.TryAddWithoutValidation("Content-Type", $"multipart/form-data;boundary={boundary}");
|
||||
|
||||
|
||||
WriteMultipartFormContent(content, req.FormParameters);
|
||||
WriteMultipartFormFileContent(content, req.FileParameters);
|
||||
|
||||
reqMsg.Content = content;
|
||||
req.RequestSet?.Invoke(reqMsg); // 位置不能变,防止外部修改 Content-Type
|
||||
reqMsg.Content.Headers.TryAddWithoutValidation("Content-Type", $"multipart/form-data;boundary={boundary}");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -107,8 +108,9 @@ namespace OSS.Http
|
||||
|
||||
reqMsg.Content = new StringContent(data);
|
||||
reqMsg.Content.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded");
|
||||
req.RequestSet?.Invoke(reqMsg);
|
||||
}
|
||||
req.RequestSet?.Invoke(reqMsg);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -35,5 +35,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.1.0")]
|
||||
[assembly: AssemblyFileVersion("2.1.0")]
|
||||
[assembly: AssemblyVersion("2.1.1")]
|
||||
[assembly: AssemblyFileVersion("2.1.1")]
|
||||
|
||||
Reference in New Issue
Block a user