public void UnBatch() { if (StringComparer.OrdinalIgnoreCase.Equals(_request.Method, "POST") && RequestStream != null) { string[] postData = Encoding.UTF8.GetString(RequestStream.ToArray()).Split(new char[] { '\n', ' ' }, StringSplitOptions.RemoveEmptyEntries); string url = string.Empty; for (int i = 0; i < postData.Length; i++) { if (StringComparer.Ordinal.Equals(postData[i].Trim(), "GET") && i + 1 < postData.Length) { url = postData[i + 1].Trim(); break; } } if (!String.IsNullOrEmpty(url)) { IsBatchRequest = true; _batchBoundaryId = _request.ContentType.Split(new string[] { "batch_" }, StringSplitOptions.RemoveEmptyEntries)[1].Trim(); _request = HttpWebRequest.CreateHttp(url); } } }
public string GetRequestContentAsString() { var content = RequestStream.ToArray(); var contentAsString = System.Text.Encoding.UTF8.GetString(content); return(contentAsString); }
/// <summary> /// Returns the request contents as a string. /// </summary> public string ContentAsString() { return(Encoding.UTF8.GetString(RequestStream.ToArray())); }