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;
}