public IApiRequest AddBody(object obj) { string serialized; string contentType; switch (RequestFormat) { case DataFormat.Json: serialized = _jsonSerializer.Serialize(obj); contentType = "application/json"; break; case DataFormat.Xml: serialized = _xmlSerializer.Serialize(obj); contentType = "text/xml"; break; case DataFormat.FormUrlEncoded: serialized = _formUrlEncodedSerializer.Serialize(obj); contentType = "application/x-www-form-urlencoded"; break; default: serialized = string.Empty; contentType = string.Empty; break; } return(AddParameter( new Parameter { Name = contentType, Value = serialized, Type = ParameterType.RequestBody })); }