File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,6 +28,11 @@ public partial class WebManager : GameFrameworkModule, IWebManager
2828 /// </summary>
2929 private readonly List < WebBinaryData > m_SendingBinaryList = new List < WebBinaryData > ( 16 ) ;
3030
31+ /// <summary>
32+ /// Binary内容类型常量
33+ /// </summary>
34+ private const string BinaryContentType = "application/octet-stream" ;
35+
3136 /// <summary>
3237 /// 更新处理ProtoBuf请求队列
3338 /// </summary>
@@ -94,6 +99,7 @@ private async void MakeBinaryBytesRequest(WebBinaryData webData)
9499
95100 unityWebRequest . timeout = ( int ) RequestTimeout . TotalSeconds ;
96101 {
102+ unityWebRequest . SetRequestHeader ( "Content-Type" , BinaryContentType ) ;
97103 byte [ ] postData = webData . SendData ;
98104 unityWebRequest . uploadHandler = new UploadHandlerRaw ( postData ) ;
99105 }
@@ -116,6 +122,7 @@ private async void MakeBinaryBytesRequest(WebBinaryData webData)
116122 HttpWebRequest request = WebRequest . CreateHttp ( webData . URL ) ;
117123 request . Method = webData . IsGet ? WebRequestMethods . Http . Get : WebRequestMethods . Http . Post ;
118124 request . Timeout = ( int ) RequestTimeout . TotalMilliseconds ; // 设置请求超时时间
125+ request . ContentType = BinaryContentType ;
119126 byte [ ] postData = webData . SendData ;
120127 request . ContentLength = postData . Length ;
121128 using ( Stream requestStream = request . GetRequestStream ( ) )
@@ -157,6 +164,7 @@ private async void MakeBinaryBytesRequest(WebBinaryData webData)
157164 {
158165 m_SendingBinaryList . Remove ( webData ) ;
159166 }
167+
160168#endif
161169 }
162170
You can’t perform that action at this time.
0 commit comments