Beispiel #1
0
        public static async Task <HttpWebRequest> CreateRequestAsync(this string url, string body)
        {
            HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);

            webRequest.Method           = "POST";
            webRequest.ReadWriteTimeout = 50000;
            webRequest.AppendHeaders(new Dictionary <string, string> {
                ["Content-Type"] = "application/json"
            });
            await webRequest.AppendBodyAsync(body);

            webRequest.Timeout = 50000;
            return(webRequest);
        }