/// <summary> /// Sets the body data of the request as a string. This method assumes the use of /// the application/x-www-form-urlencoded data type (<see cref="UnityAgentFormDataType"/>) and /// will append the data each time this method is called seperated by an ampersand. /// To set a custom data type use the other overloads. /// </summary> /// <param name="data">The body data of the request.</param> /// <returns>Returns this <see cref="UnityAgentRequest"/> object so that calls can be chained.</returns> public UnityAgentRequest Send(string data) { if (_data == null) { var formData = new UnityAgentFormDataType(); formData.AppendData(data); _data = formData; } else { if (_data is UnityAgentFormDataType) { (_data as UnityAgentFormDataType).AppendData(data); } else { throw new Exception("Data type is already set to something other than form. Cannot use this method."); } } return(this); }
/// <summary> /// Sets the body data of the request as a string. This method assumes the use of /// the application/x-www-form-urlencoded data type (<see cref="UnityAgentFormDataType"/>) and /// will append the data each time this method is called seperated by an ampersand. /// To set a custom data type use the other overloads. /// </summary> /// <param name="data">The body data of the request.</param> /// <returns>Returns this <see cref="UnityAgentRequest"/> object so that calls can be chained.</returns> public UnityAgentRequest Send(string data) { if (_data == null) { var formData = new UnityAgentFormDataType(); formData.AppendData(data); _data = formData; } else { if (_data is UnityAgentFormDataType) { (_data as UnityAgentFormDataType).AppendData(data); } else { throw new Exception("Data type is already set to something other than form. Cannot use this method."); } } return this; }