public void ToStringTest()
        {
            ProviderCarrier carrier = new ProviderCarrier();
            carrier.Route = "/login";
            carrier.ParamList.Add("email", "*****@*****.**");
            carrier.GenericList.Add("other", "another thing here.");
            carrier.GenericList.Add("money", 3);

            carrier.ToString();
        }
Example #2
0
        public void _Connect(int requestCode, ProviderCarrier carrier)
        {
            if (carrier == null)
            {
                Handle(new ProviderLoadedEventArgs(0, 0, null));
                return;
            }

            int status = 0;
            string json = null;
            HttpWebRequest request = null;
            HttpWebResponse respone = null;

            try
            {
                string uriScheme = ProviderSettings.ToString();
                string equipmentDesc = EquipmentUtils.EquipmentDescription();
                // Payload data to be send
                byte[] payload = Encoding.UTF8.GetBytes(carrier.ToString());

                request = (HttpWebRequest) WebRequest.Create(uriScheme);
                request.Method = "POST";
                request.ContentLength = payload.Length;
                request.UserAgent = equipmentDesc;

                WriteStream(request.GetRequestStream(), payload);

                respone = (HttpWebResponse) request.GetResponse();

                status = (int) respone.StatusCode;

                json = ReadStream(respone.GetResponseStream(), respone.ContentEncoding);
            }
            catch (Exception) {}

            Handle(new ProviderLoadedEventArgs(requestCode, status, json));
        }