Example #1
0
        public async Task <WebResponse> SendAsync(HttpRequestType type, string url = "", string value = null)
        {
            url.TrimStart('/');
            HttpMethod method = new HttpMethod(type.Read());

            using (HttpRequestMessage request = new HttpRequestMessage(method, url))
            {
                if (!string.IsNullOrWhiteSpace(value))
                {
                    request.Content = new StringContent(value, Encoding.UTF8, HttpApplicationType.JSON.Read());
                    request.Content.Headers.ContentType.CharSet = null; // This is the UTF-8 being removed, to make sure it can actually format the value given.
                }
                return(await SendAsync(request));
            }
        }