Ejemplo n.º 1
0
        protected override Response ParseNetworkResponse(NetworkResponse response)
        {
            try
            {
                var responseData = response.Data.ToString()[0];
                var header       = new Dictionary <string, string>();

                foreach (KeyValuePair <string, string> kvp in response.Headers)
                {
                    header.Add(kvp.Key, kvp.Value);
                }
                Dictionary <string, string> headerData = header;

                string jsonString = new string(responseData, HttpHeaderParser.ParseCharset(headerData).Count());
                return(Response.Success(new JSONObject(jsonString),
                                        HttpHeaderParser.ParseCacheHeaders(response)));
            }
            catch (UnsupportedEncodingException e)
            {
                return(Response.Error(new ParseError(e)));
            }
            catch (JSONException je)
            {
                return(Response.Error(new ParseError(je)));
            }
        }
 public override Response ParseNetworkResponse(NetworkResponse response)
 {
     Java.Lang.String parsed;
     try
     {
         parsed = new Java.Lang.String(response.Data, HttpHeaderParser.ParseCharset(response.Headers));
     }
     catch (Java.IO.UnsupportedEncodingException)
     {
         parsed = new Java.Lang.String(response.Data);
     }
     return(Response.Success(parsed.ToString(), HttpHeaderParser.ParseCacheHeaders(response)));
 }