Exemplo n.º 1
0
 public virtual byte[] GetJson()
 {
     byte[] result = null;
     if (body != null)
     {
         result = body.GetJson();
     }
     return(result);
 }
Exemplo n.º 2
0
        public IEnumerable <Byte> GetJson()
        {
            IEnumerable <Byte> result = null;

            if (body != null)
            {
                result = body.GetJson();
            }
            return(result);
        }
Exemplo n.º 3
0
        internal virtual object ParseJSONResponse(HttpURLConnection conn)
        {
            Object result = null;
            var stream = conn.GetOutputStream();
            var bytesRead = 0L;
            const Int32 chunkSize = 8192;
             
            var bytes = stream.ReadAllBytes();

            var responseBody = new Body(bytes);
            if (responseBody != null)
            {
                var json = responseBody.GetJson();
                String jsonString = null;
                if (json != null)
                {
                    jsonString = Runtime.GetStringForBytes(json);
                    try
                    {
                        result = mapper.ReadValue<object>(jsonString);
                    }
                    catch (Exception)
                    {
                        Assert.Fail();
                    }
                }
            }
            return result;
        }