Exemplo n.º 1
0
        private HttpJsonRequest(Uri url, RequestMethod method, JObject metadata, ICredentials credentials)
        {
            webRequest = WebRequest.Create(url) as HttpWebRequest;
            webRequest.Credentials = credentials;
            WriteMetadata(metadata);
            webRequest.Method = method.GetName();

            switch (method)
            {
                case RequestMethod.POST:
                    webRequest.ContentType = "application/json; charset=utf-8";
                    break;
                default:
                    break;
            }
        }