fix: cloud function no params.

oneRain 2021-04-29 15:56:52 +08:00
parent 2c81ae0c0d
commit b91403bef6
1 changed files with 3 additions and 2 deletions

View File

@ -30,7 +30,7 @@ namespace LeanCloud.Storage {
Dictionary<string, object> headers = new Dictionary<string, object> {
{ PRODUCTION_KEY, IsProduction ? 1 : 0 }
};
object encodeParams = LCEncoder.Encode(parameters);
object encodeParams = LCEncoder.Encode(parameters ?? new Dictionary<string, object>());
Dictionary<string, object> response = await LCCore.HttpClient.Post<Dictionary<string, object>>(path,
headers: headers,
data: encodeParams);
@ -59,7 +59,8 @@ namespace LeanCloud.Storage {
/// <param name="name">Cloud function name.</param>
/// <param name="parameters">Parameters of cloud function.</param>
/// <returns>LCObject, List<LCObject>, or Map<string, LCObject>.</returns>
public static async Task<object> RPC(string name, object parameters = null) {
public static async Task<object> RPC(string name,
object parameters = null) {
string path = $"call/{name}";
Dictionary<string, object> headers = new Dictionary<string, object> {
{ PRODUCTION_KEY, IsProduction ? 1 : 0 }