/// <inheritdoc/>
        public override HttpContent?SerializeBody <T>(T body, RequestBodySerializerInfo info)
        {
            if (body == null)
            {
                return(null);
            }

            var content = new StringContent(JsonConvert.SerializeObject(body, this.JsonSerializerSettings));

            content.Headers.ContentType.MediaType = "application/json";
            return(content);
        }
Esempio n. 2
0
 public override HttpContent SerializeBody <T>(T body, RequestBodySerializerInfo info) =>
 this.serializer.SerializeBody(body);
 /// <summary>
 /// Serialize the given request body
 /// </summary>
 /// <param name="body">Body to serialize</param>
 /// <param name="info">Extra information about the request</param>
 /// <typeparam name="T">Type of the body to serialize</typeparam>
 /// <returns>HttpContent to assign to the request</returns>
 public virtual HttpContent?SerializeBody <T>(T body, RequestBodySerializerInfo info)
 {
     throw new NotImplementedException($"You must override and implement SerializeBody<T>(T body, RequestBodySerializerInfo info) in {this.GetType().Name}");
 }