Foretagsplatsen.Api2.SamlRestClient.CreateRequest C# (CSharp) Method

CreateRequest() public method

public CreateRequest ( string httpMethod, string url, object arguments ) : HttpWebRequest
httpMethod string
url string
arguments object
return System.Net.HttpWebRequest
        public override HttpWebRequest CreateRequest(string httpMethod, string url, object arguments)
        {
            var request = (HttpWebRequest) WebRequest.Create(url);

            request.Accept = "application/json";
            request.Method = httpMethod;
            request.ContentType = "application/json";
            request.Headers.Add("SamlAssertion", samlAssertion);

            if (arguments != null && (httpMethod == "POST" || httpMethod == "PUT"))
            {
                using (var writer = new StreamWriter(request.GetRequestStream()))
                {
                    writer.Write(arguments.ToString());
                }
            }
            else if (httpMethod == "POST" || httpMethod == "PUT")
            {
                request.ContentLength = 0;
            }

            return request;
        }