Skip to content

Commit

Permalink
Merge pull request #412 from auth0/fix-boolean-multipart-form-casing
Browse files Browse the repository at this point in the history
Fix multipart boolean form casing
  • Loading branch information
lbalmaceda authored Jun 23, 2020
2 parents 46e9c11 + 994f741 commit 78a25ae
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Auth0.ManagementApi/HttpClientManagementConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,15 @@ private static HttpContent CreateMultipartFormDataContent(IList<FileUploadParame
if (body is Dictionary<string, object> parameters)
foreach (var parameter in parameters)
if (parameter.Value != null)
content.Add(new StringContent(Uri.EscapeDataString(parameter.Value.ToString())), parameter.Key);
content.Add(new StringContent(SerializeFormBodyValue(parameter.Value)), parameter.Key);

return content;
}

private static string SerializeFormBodyValue(object value)
{
if (value is bool boolean) return boolean ? "true" : "false";
return Uri.EscapeDataString(value.ToString());
}
}
}

0 comments on commit 78a25ae

Please sign in to comment.