private async Task <RestResponse> Request(Uri uri, Dictionary <string, string> data)
        {
            var content = new MultipartFormDataContent();

            foreach (var pair in data)
            {
                content.Add(new StringContent(pair.Value), pair.Key);
            }

            var response = await http.PostAsync(uri, content);

            return(await RestResponse.Create(response));
        }
示例#2
0
        private async Task <RestResponse> Request(Uri uri, Dictionary <string, string> data)
        {
            /*
             * var content = new MultipartFormDataContent();
             *
             * foreach (var pair in data)
             * content.Add(new StringContent(pair.Value), pair.Key);
             */
            var uriString = uri.ToString();

            foreach (var pair in data)
            {
                uriString += "&" + pair.Key + "=" + Uri.EscapeUriString(pair.Value);
            }

            var response = await http.PostAsync(new Uri(uriString), new StringContent(""));

            return(await RestResponse.Create(response));
        }
        private async Task <RestResponse> Request(Uri uri, string data)
        {
            var response = await http.PostAsync(uri, new StringContent(data));

            return(await RestResponse.Create(response));
        }
        private async Task <RestResponse> Request(Uri uri)
        {
            var response = await http.GetAsync(uri);

            return(await RestResponse.Create(response));
        }