public MultipartFormDataStream(HTTPRequest request) { this.boundary = "BestHTTP_MultipartFormDataStream_" + this.GetHashCode().ToString("X2"); request.SetHeader("Content-Type", "multipart/form-data; boundary=" + boundary); request.UploadStream = this; request.UseUploadStreamLength = true; }
/// <summary> /// Prepares the request by adding two headers to it /// </summary> public void PrepareRequest(BestHTTP.HTTPRequest request) { request.SetHeader("x-redirect-count", _connection.RedirectCount.ToString()); if (HTTPProtocolFactory.GetProtocolFromUri(request.CurrentUri) == SupportedProtocols.HTTP) { request.Uri = PrepareUri(request.Uri); } }
/// <summary> /// OSS Get /// </summary> /// <param name="url"></param> /// <param name="post"></param> /// <param name="OnRequestFinished"></param> /// <param name="token"></param> public static void OssGet(string url, KeyValuePair <string, string>[] post, OnRequestFinishedDelegate OnRequestFinished, string token = null) { BestHTTP.HTTPRequest request = new BestHTTP.HTTPRequest(new Uri(url), true, OnRequestFinished); request.Timeout = TimeSpan.FromMinutes(10); request.ConnectTimeout = TimeSpan.FromMinutes(5); if (post != null) { foreach (var item in post) { request.SetHeader(item.Key, item.Value); } } request.Send(); }
public override void PrepareRequest(HTTPRequest request) { // Set up Content-Type header for the request request.SetHeader("Content-Type", "multipart/form-data; boundary=\"" + Boundary + "\""); }