Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion RestSharp.Tests/NamespacedXmlTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#region Licensed
#region Licensed
// Copyright 2010 John Sheehan
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion RestSharp.sln
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30723.0
Expand Down
27 changes: 26 additions & 1 deletion RestSharp/IRestRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ public interface IRestRequest
#endif

/// <summary>
/// Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer
/// Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer.
/// The default format is XML. Change RequestFormat if you wish to use a different serialization format.
/// </summary>
/// <param name="obj">The object to serialize</param>
/// <param name="xmlNamespace">The XML namespace to use when serializing</param>
Expand All @@ -169,11 +170,35 @@ public interface IRestRequest

/// <summary>
/// Serializes obj to data format specified by RequestFormat and adds it to the request body.
/// The default format is XML. Change RequestFormat if you wish to use a different serialization format.
/// </summary>
/// <param name="obj">The object to serialize</param>
/// <returns>This request</returns>
IRestRequest AddBody (object obj);

/// <summary>
/// Serializes obj to JSON format and adds it to the request body.
/// </summary>
/// <param name="obj">The object to serialize</param>
/// <returns>This request</returns>
IRestRequest AddJsonBody(object obj);

/// <summary>
/// Serializes obj to XML format and adds it to the request body.
/// </summary>
/// <param name="obj">The object to serialize</param>
/// <returns>This request</returns>
IRestRequest AddXmlBody(object obj);

/// <summary>
/// Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer
/// Serializes obj to XML format and passes xmlNamespace then adds it to the request body.
/// </summary>
/// <param name="obj">The object to serialize</param>
/// <param name="xmlNamespace">The XML namespace to use when serializing</param>
/// <returns>This request</returns>
IRestRequest AddXmlBody(object obj, string xmlNamespace);

/// <summary>
/// Calls AddParameter() for all public, readable properties specified in the includedProperties list
/// </summary>
Expand Down
40 changes: 39 additions & 1 deletion RestSharp/RestRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ private IRestRequest AddFile (FileParameter file)
}

/// <summary>
/// Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer
/// Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer.
/// The default format is XML. Change RequestFormat if you wish to use a different serialization format.
/// </summary>
/// <param name="obj">The object to serialize</param>
/// <param name="xmlNamespace">The XML namespace to use when serializing</param>
Expand Down Expand Up @@ -244,6 +245,7 @@ public IRestRequest AddBody (object obj, string xmlNamespace)

/// <summary>
/// Serializes obj to data format specified by RequestFormat and adds it to the request body.
/// The default format is XML. Change RequestFormat if you wish to use a different serialization format.
/// </summary>
/// <param name="obj">The object to serialize</param>
/// <returns>This request</returns>
Expand All @@ -252,6 +254,42 @@ public IRestRequest AddBody (object obj)
return AddBody(obj, "");
}

/// <summary>
/// Serializes obj to JSON format and adds it to the request body.
/// </summary>
/// <param name="obj">The object to serialize</param>
/// <returns>This request</returns>
public IRestRequest AddJsonBody(object obj)
{
RequestFormat = DataFormat.Json;
return AddBody(obj, "");
}

/// <summary>
/// Serializes obj to XML format and adds it to the request body.
/// </summary>
/// <param name="obj">The object to serialize</param>
/// <returns>This request</returns>
public IRestRequest AddXmlBody(object obj)
{
RequestFormat = DataFormat.Xml;
return AddBody(obj, "");
}

/// <summary>
/// Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer
/// Serializes obj to XML format and passes xmlNamespace then adds it to the request body.
/// </summary>
/// <param name="obj">The object to serialize</param>
/// <param name="xmlNamespace">The XML namespace to use when serializing</param>
/// <returns>This request</returns>
public IRestRequest AddXmlBody(object obj, string xmlNamespace)
{
RequestFormat = DataFormat.Xml;
return AddBody(obj, xmlNamespace);
}


/// <summary>
/// Calls AddParameter() for all public, readable properties specified in the includedProperties list
/// </summary>
Expand Down