OneDrive/ODConnection.cs
/// <summary>
/// Serializes the body object and writes in into the request stream of the HttpWebRequest instance.
/// </summary>
/// <param name="obj"></param>
/// <param name="request"></param>
/// <returns></returns>
Serializes the body object and writes in into the request stream of the HttpWebRequest instance.
Serializes the body object and writes in into the request stream of the HttpWebRequest instance .
private async Task SerializeObjectToRequestBody(object obj, Http.IHttpRequest request)
        {
            request.ContentType = ApiConstants.ContentTypeJson;
            var settings = new Newtonsoft.Json.JsonSerializerSettings();
            settings.Converters.Add(new Newtonsoft.Json.Converters.StringEnumConverter());
            var bodyText = Newtonsoft.Json.JsonConvert.SerializeObject(obj, settings);
            var requestStream = await request.GetRequestStreamAsync();
            var writer = new StreamWriter(requestStream, Encoding.UTF8, 1024 * 1024, true);
            await writer.WriteAsync(bodyText);
            await writer.FlushAsync();
        }
private async Task SerializeObjectToRequestBody ( object obj , Http . IHttpRequest request ) { request . ContentType = ApiConstants . ContentTypeJson ; var settings = new Newtonsoft . Json . JsonSerializerSettings ( ) ; settings . Converters . Add ( new Newtonsoft . Json . Converters . StringEnumConverter ( ) ) ; var bodyText = Newtonsoft . Json . JsonConvert . SerializeObject ( obj , settings ) ; var requestStream = await request . GetRequestStreamAsync ( ) ; var writer = new StreamWriter ( requestStream , Encoding . UTF8 , 1024 * 1024 , true ) ; await writer . WriteAsync ( bodyText ) ; await writer . FlushAsync ( ) ; }
Serializes the body object and writes in into the request stream of the HttpWebRequest instance.
Serializes the body object and writes in into the request stream of the HttpWebRequest instance .
None
obj
object
None
request
Http.IHttpRequest
None