@@ -207,7 +207,8 @@ private IRestRequest AddFile (FileParameter file)
207
207
}
208
208
209
209
/// <summary>
210
- /// Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer
210
+ /// Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer.
211
+ /// The default format is XML. Change RequestFormat if you wish to use a different serialization format.
211
212
/// </summary>
212
213
/// <param name="obj">The object to serialize</param>
213
214
/// <param name="xmlNamespace">The XML namespace to use when serializing</param>
@@ -244,6 +245,7 @@ public IRestRequest AddBody (object obj, string xmlNamespace)
244
245
245
246
/// <summary>
246
247
/// Serializes obj to data format specified by RequestFormat and adds it to the request body.
248
+ /// The default format is XML. Change RequestFormat if you wish to use a different serialization format.
247
249
/// </summary>
248
250
/// <param name="obj">The object to serialize</param>
249
251
/// <returns>This request</returns>
@@ -252,6 +254,42 @@ public IRestRequest AddBody (object obj)
252
254
return AddBody ( obj , "" ) ;
253
255
}
254
256
257
+ /// <summary>
258
+ /// Serializes obj to JSON format and adds it to the request body.
259
+ /// </summary>
260
+ /// <param name="obj">The object to serialize</param>
261
+ /// <returns>This request</returns>
262
+ public IRestRequest AddJsonBody ( object obj )
263
+ {
264
+ RequestFormat = DataFormat . Json ;
265
+ return AddBody ( obj , "" ) ;
266
+ }
267
+
268
+ /// <summary>
269
+ /// Serializes obj to XML format and adds it to the request body.
270
+ /// </summary>
271
+ /// <param name="obj">The object to serialize</param>
272
+ /// <returns>This request</returns>
273
+ public IRestRequest AddXmlBody ( object obj )
274
+ {
275
+ RequestFormat = DataFormat . Xml ;
276
+ return AddBody ( obj , "" ) ;
277
+ }
278
+
279
+ /// <summary>
280
+ /// Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer
281
+ /// Serializes obj to XML format and passes xmlNamespace then adds it to the request body.
282
+ /// </summary>
283
+ /// <param name="obj">The object to serialize</param>
284
+ /// <param name="xmlNamespace">The XML namespace to use when serializing</param>
285
+ /// <returns>This request</returns>
286
+ public IRestRequest AddXmlBody ( object obj , string xmlNamespace )
287
+ {
288
+ RequestFormat = DataFormat . Xml ;
289
+ return AddBody ( obj , xmlNamespace ) ;
290
+ }
291
+
292
+
255
293
/// <summary>
256
294
/// Calls AddParameter() for all public, readable properties specified in the includedProperties list
257
295
/// </summary>
0 commit comments