Esempio n. 1
0
 public MultipartResult(string subtype = "byteranges", string boundary = null)
 {
     if (boundary == null)
     {
         this.content = new System.Net.Http.MultipartContent(subtype);
     }
     else
     {
         this.content = new System.Net.Http.MultipartContent(subtype, boundary);
     }
 }
Esempio n. 2
0
 public MultipartResult(string subtype = "x-mixed-replace", string boundary = "canonliveview")
 {
     if (boundary == null)
     {
         this.content = new System.Net.Http.MultipartContent(subtype);
     }
     else
     {
         this.content = new System.Net.Http.MultipartContent(subtype, boundary);
     }
 }
Esempio n. 3
0
        private static async void Request_POST_MultipartContent(string uri, string raw, string timeKey)
        {
            using (var client = new System.Net.Http.HttpClient())
                using (var batchRequest = new System.Net.Http.HttpRequestMessage(System.Net.Http.HttpMethod.Post, uri))
                {
                    System.Net.Http.MultipartContent batchContent = new System.Net.Http.MultipartContent("batch");
                    batchRequest.Content = batchContent;

                    batchContent.Add(new System.Net.Http.StringContent(raw, System.Text.Encoding.UTF8, "application/json"));


                    await client.SendAsync(batchRequest).ContinueWith(responseTask =>
                    {
                        dicResult.Add(timeKey, responseTask.Result.Content.ReadAsStringAsync().Result);
                    });
                }
        }
 /// <summary>创建 <see cref="T:System.Net.Http.MultipartContent" /> 类的新实例。</summary>
 /// <param name="subtype">多部分内容的子类型。</param>
 /// <exception cref="T:System.ArgumentException">
 /// <paramref name="subtype" /> 为 <see langword="null" /> 或者只包含空格字符。</exception>
 public MultipartContent(string subtype)
     : this(subtype, MultipartContent.GetDefaultBoundary())
 {
 }
 /// <summary>创建 <see cref="T:System.Net.Http.MultipartContent" /> 类的新实例。</summary>
 public MultipartContent()
     : this("mixed", MultipartContent.GetDefaultBoundary())
 {
 }