Пример #1
0
        public void Delete(string host,
                           string path,
                           string json,
                           IDictionary <string, string> headers,
                           Action <string, FizzException> callback)
        {
            Action <string, FizzException> onDone = FizzUtils.SafeCallback(callback);

            if (json == null)
            {
                onDone.Invoke(null, ERROR_INVALID_CONTENT);
                return;
            }

            byte[] buffer = Encoding.UTF8.GetBytes(json);
            SendRequestAsync(host, path, "DELETE", headers, CONTENT_TYPE, buffer.Length, buffer, (status, response, ex) =>
            {
                if (ex != null)
                {
                    onDone.Invoke(null, ex);
                }
                else
                {
                    FormatResponse(status, response, onDone);
                }
            });
        }
Пример #2
0
        public void Get(string host,
                        string path,
                        IDictionary <string, string> headers,
                        Action <string, FizzException> callback)
        {
            Action <string, FizzException> onDone = FizzUtils.SafeCallback(callback);

            SendRequestAsync(host, path, "GET", headers, CONTENT_TYPE, 0, null, (status, response, ex) =>
            {
                if (ex != null)
                {
                    FizzUtils.DoCallback(null, ex, onDone);
                }
                else
                {
                    FormatResponse(status, response, onDone);
                }
            });
        }