Esempio n. 1
0
        /**
         * GET with result parsed as object
         */
        public void GET(string endPoint, GETDictCallback cb)
        {
            HTTP.Request req = new HTTP.Request( "get", this.baseURL + endPoint );

            // Add headers
            foreach (DictionaryEntry h in headers) {
                req.AddHeader((string) h.Key, (string) h.Value);
            }

            req.Send( ( request ) => {
                var resObj = Json.Deserialize(request.response.Text) as Dictionary<string, object>;
                cb(resObj);
            });
        }
Esempio n. 2
0
        /**
         * POST with result parsed as Dictionary<string,object>
         */
        public void POST(string endPoint, Hashtable body, GETDictCallback cb)
        {
            Console.WriteLine(this.baseURL + endPoint);
            HTTP.Request req = new HTTP.Request( "post", this.baseURL + endPoint, body );

            // Add headers
            foreach (DictionaryEntry h in headers) {
                req.AddHeader((string) h.Key, (string) h.Value);
            }

            req.Send( ( request ) => {
                var resObj = Json.Deserialize(request.response.Text) as Dictionary<string, object>;
                cb(resObj);
            });
        }