Esempio n. 1
0
        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);
                }
            }
        }
Esempio n. 2
0
        public string GetRequestContentAsString()
        {
            var content         = RequestStream.ToArray();
            var contentAsString = System.Text.Encoding.UTF8.GetString(content);

            return(contentAsString);
        }
Esempio n. 3
0
 /// <summary>
 /// Returns the request contents as a string.
 /// </summary>
 public string ContentAsString()
 {
     return(Encoding.UTF8.GetString(RequestStream.ToArray()));
 }